4 Replies Latest reply on Apr 26, 2017 3:59 AM by beverly

    Web viewer

    milky

      Hi All,

       

      could anyone one point me in the right direction to where I might obtain HTML for a countdown timer that I wish to use in a webviewer.

       

      Thanks in advance.

       

      Milton.

        • 1. Re: Web viewer
          beverly

          Try this one.

          go to the "Try it yourself" to get the full text to copy.

          Place all of the text into a field (global) and then do this in the Web Viewer:

           

          "data:text/html," & yourfield_here

           

          This uses HTML, CSS and JavaScript. YMMV (it may or may not work as-is for you)

          beverly

          • 2. Re: Web viewer
            beverly

            I forgot to add...

            There is a hard coded date in the code.

            // Set the date we're counting down to

            var countDownDate = new Date("Jan 5, 2018 15:37:25").getTime();

             

            change this or make it a field (global or otherwise):

             

            And use this in the Web Viewer:

            "data:text/html," & Substitute( yourfield_here ; "Jan 5, 2018 15:37:25" ; yourdate_here )

             

            NOTICE the format of the date and study what makes a "valid" date/time in JavaScript.

            beverly

            • 3. Re: Web viewer
              milky

              Thanks Beverly,

               

              Got that to work by cutting and pasting. (although I tried altering the date by replacing var countDownDate as you suggested but could not get this to work)

               

              The Date is always the CurrentDate, so days are not required.

               

              I need the ability to have up to 30 "Timers" that occur one after the other, whereby the organiser when setting up the event specifies the starting time of the event (Event::StartTime) and then specifies the length of time for each "Timer" (Event::Level1 Duration) required that commence immediately after the previous timer.

               

              I have included an example made in excel below that shows the structure that I require.

              I would also require the ability to "pause" the timer and then "recommence" the timer.

               

              If you have any suggestions it would be greatly appreciated.

               

              I am using FMPro 12 Adv with Windows 10 and have not used JavaScript HTML or CSS before.

               

              Kind Regards

               

              Milton

               

              timer example setup.jpg

              • 4. Re: Web viewer
                beverly

                Wow! There are many JavaScript functions that involve time. And there may be other JS snippets that do other things. I'm glad this one worked for you.

                beverly