ColdFusion with JavaScript timer

Hello ~

I use a JavaScript timer on a .cfm page. So far, everything works, but what I want to do is, when the time reaches zero, a button appears on the page. At present, the work of timer, but when it gets to zero, nothing happens right here. This whole .cfm page serves as an inclusion in another .cfm page. I'm not very familiar with Javascript, so I would be grateful for any suggestion. Thank you!

< cfoutput >

< cfset totalSeconds = #currentTopicTime # >

< cfset totalMinutes = Int(#totalSeconds#/60) >
< cfset remainingSeconds = #totalSeconds # MOD 60 >

< script type = "text/javascript" >
var minutes = #totalMinutes #;
seconds var #remainingSeconds = #;

function countDown() {}
reduction of the
seconds;
If (seconds ==-01) {}
seconds = 59;
minutes = minutes - 1;
} else {}
minutes = minutes;
}
If (seconds < = 9) {seconds = '0' + seconds ;}}
time = "you must see this page for #totalMinutes # minutes < cfif remainingSeconds NEQ 0 > and < cfif remainingSeconds LTE 9 > 0 < / cfif > #remainingSeconds # seconds < / cfif >.» < br / > you have "+ (" minutes < = 9? ")" 0 "(+ minutes: minutes) +" minutes and "+ seconds +" seconds remaining. < br / > please read this page until the timer reaches 0. < br / > please DO NOT refresh this page & mdash; This will restart the timer! » ;
If (document.getElementById) {document.getElementById('theTime').innerHTML = time ;}
SD = Window.setTimeout ("countDown ();', 1000");
If (minutes == '00' & & seconds == '00') {seconds = '00'; window.clearTimeout (SD) ;}
}

function addLoadEvent (func) {}
var oldonload = window.onload;
If (typeof window.onload! = 'function') {}
Window.OnLoad = func;
} else {}
Window.OnLoad = function() {}
If {(oldonload)
oldonload();
}
Func();
}
}
}

{addLoadEvent (function ()}
countDown();
});
< /script >

< hr style = "margin-bottom: 3px;" margin-top: 3px; Width: 90%; "/ >
< id p "theTime" = class = "timeClass" > < / p >

< / cfoutput >

When the time-out is reached the code does nothing special. You must

show the button right there (my example assumes the visibility of)

the button is set to hidden, to adapt to your own situation):

if (minutes == '00' && seconds == '00') {  window.clearTimeout(SD);
document.getElementById("id_of_your_button").style.visibility = ''; }

Mack

Tags: ColdFusion

Similar Questions

  • ColdFusion scheduled task for HTML files with javascript ajax call to the web service

    I have a regular html file, which are generated dynamically (on access to it) for a few seconds (about 7 to 10 seconds) as tables, lines that are added through javascript after having treatment and this process takes about 7-10 seconds of said.

    Using settimeout(), after 15 seconds (to ensure that the content has been correctly filled), I use a web service (.cfc with function with intrusion via cfmail tag inside) through the ajax javascript call, which captures all the html content of the page and sends it to marked e-mail ID - which, during normal operations, works very well - which page is accessible in the browser web and left pending for desired time of 15-20 seconds.

    However, the same page when I programmed in CF admin (even with the time-out of 60 seconds), it never fires the e-mail part.

    Can I have some advice, where I am doing wrong!

    Hi, I mean the scheduled activity could be accomplished using CF native heavyweight instead of light and fast javascript codes codes. Not a big problem anyway.

  • Visibility of scene with javascript

    Hello

    , I create a pdf document, creating a scene of u3d. The scene contains two objects in scene, one with a visibility FRONT only and the other with a REAR visibility only (essentially the same as openGLs front and back of slaughter). If I manipulate not nodes in scene with javascript, everything works correctly, i.e. for the first object only its front is drawn and the second object only the rear side is drawn.

    However, if I use javascript to hide the objects in the scene and show them once again, each object is drawn with two visible sides (front and back). In my JavaScript code, I use the attribute .visible among the objects in the scene, which is a Boolean value according to the JS notes 3D API reference (e.g. scnobj.visible = true/false to show/hide)

    This is expected behavior? Can I control the visibility FRONT and BACK of my objects in scene with javascript somehow?

    Thank you!

    Dear Dave,

    Thank you very much prompt response. Deletion of the declaration of scene.renderDoubleSided = true did the trick. It seems that I put it by accident all fooling with js some time ago.

    He now works as expected.

  • Open and close the Popup with Javascript

    Using Apex 3.2

    I probably have done this lots of times in my old job, but do not have access to the code and now I can't work properly.

    I opened a window pop up with javascript
    Now, I need to close and refresh the calling page, but only if it ratifies the validation on the popup.
    I have an item hidden on my pop up called P7_FLAG.
    I have a process page after validation that affects P7_FLAG (only the value 1, if passes validation).
    I also have a "SUBMIT" button.

    So once I click my button "SUBMIT" page should look at validations, so ok, P7_FLAG the value 1, then close the popup and refresh the calling page.

    My current look of javascript like this
    <script type="text/javascript">
    function saveChanges(){
    doSubmit('SUBMIT');
    var test = $x('P7_FLAG').value;
    if(test == '1')
    {
    window.close();
    window.opener.doSubmit('REFRESH');
    }
    }
    </script>
    My button
    javascript:saveChanges();
    The problem is that I need to click twice on the button SUBMIT.
    First, it sets P7_FLAG
    Second time, it closes page and refreshes.

    I probably made a fundamental mistake, but today I can't.

    See you soon

    Gus

    Published by: Gus C 10 may 2012 12:48

    Sorry about that I was blind

    Add this function to your page

    
    

    Call this function on the loading of the page

    onload="onloadclose();"
    
  • Alternate slides with JavaScript (or advanced Actions)?

    I was wondering if someone out there with the knowledge of JavaScript could help me a little...

    A colleague came to me with a question about randomization of the slides. We work in Captivate 5.5. The slides are all part of a quiz (but aren't question slides). They have a click box. The idea is that if the user clicks on the box (or off the beaten track), it shows a good (or bad) legend and then jumps to a random slide (new). If the user manages at the end of the slide without selecting anything, their time is running out and they get fried to a random slide and it is regarded as an incorrect answer. The user should see all of the slides in random order, with no recurrence.

    I created a tip Action, integrating the widget of random number, and it works. My problem is that the project has 50 blades, and I'm not sure it is very feasible with advanced Actions. As it is, my test with 3 random slides is an action with 4 conditional statements, so I'm not really looking to create one for 50 slides. (I don't know even if Captivate would be able to handle this).

    Is there a way (judging) to achieve with JavaScript instead? My vague idea based on my very limited knowledge of programming is:

    1. on enter first Captivate slide, create the array of random slides - 1 slide numbers (because cpCmndGotoSlide index starts at 0)
      so if I had a project where I wanted to shoot random slides 3-8, the would be [2, 3, 4, 5, 6, 7]
    2. Shuffle/random table
    3. set up a variable called slideviews = 0 to keep track of how many slides have been seen (and so which item in the table to move to the next randomly)
    4. Create a function that I'm going to run when I want to access a random slide (whether at the end of a slide or in the success or failure of a click on a square)
      something like... If slideviews < array.length, cpCmndGotoSlide = array [slideviews]; slideviews ++; Another thing, cpCmndGotoSlide is 8 (jump at the end of the slides)

    Of course, this lack of things (like the proper syntax and things needed to communicate with captivate)... but is sound logic? Is there a better way to do it?

    Come to think of it, the table and the slideviews variable should be saved if we wanted it works with bookmarking... I think that this project will be SCORM 1.2 LMS System.

    It would be nice to have a variable user I can access within the Captivate project and I can put in a legend to show the script #. Something like scenario = slideviews (I know that's not the syntax, reading series of JavaScript of Jim Leichliter on CaptivateDev.com, but that's the basic idea.)

    Anyway, pointers would be very useful! Thank you.

    Edit: I played a little bit; for randomization, I found a code online, and then I wrote something that automatically creates a table and a function for the jump to a slide randomly. Here's what I have so far (not tested in Captivate yet):

    var objCP = document.Captivate;
    
    var randomNumbers = []; 
    
     // The following creates the values for the array: 3 to 52.
     // I want to randomize slides 4-53, using cpCmndGotoSlide (index starting at 0) to jump to them
    
    for(i=3; i<53; i++) {
                        randomNumbers[i-3] = i;
    }
    
    var n = randomNumbers.length;
      var tempArr = [];
      for (i = 0; i < n-1; i++ ) {
        // The following line removes one random element from arr
        // and pushes it onto tempArr
        tempArr.push(randomNumbers.splice(Math.floor(Math.random()*randomNumbers.length),1)[0]);
      }
      // Push the remaining item onto tempArr
      tempArr.push(randomNumbers[0]);
      randomNumbers=tempArr;
    
    var slideViews = 0;
    
    var randomSlide = function() {
    if (slideViews < 50) {
                        objCP.cpEISetValue("cpCmndGotoSlide", randomNumbers[slideViews]);
                        slideViews++;
                        objCP.cpEISetValue("scenarioNumber", slideViews);
              }
              //after all the slides have been seen, jump to the final results slide
              else {
                        objCP.cpEISetValue("cpCmndGotoSlide", 53);
              }
    };
    

    I doubt it will work off the bat, but maybe this is a beginning?

    I managed to get things working, so I thought I'd post my (probably a little unwieldy and inefficient) code in case people come across this thread and want a starting point:

    var objCP = document. Captivate;
    var randomNumbers = [];
    var slideViews = 0;
    CVS var = 0;

    shuffle var = {function (array)}
    var m = array.length, t, j;
    so that {(m)
    j = Math.floor (Math.random () * m-);
    t = array [m];
    table [m] = array [j];


    table [j] = t;
    }
    };

    var jumpSlide = function() {}
    If (slideViews < randomNumbers.length) {}
    objCP.cpEISetValue ('cpCmndGotoSlide', randomNumbers [slideViews]-1);
    slideViews ++;
    objCP.cpEISetValue ('scenarioNumber', slideViews);
    }
    else {}
    objCP.cpEISetValue ('cpCmndGotoSlide', 52);
    }
    };

    var randomSlide = function() {}
    If (g_objAPI.LMSGetValue ('cmi.comments') = ") {}
    for (i = 3; i < 53; i ++) {}
    randomNumbers [i-3] = i;
    }
    Shuffle (randomNumbers);
    g_objAPI.LMSSetValue ('cmi.comments', randomNumbers);
    resume ++;
    jumpSlide();
    }
    ElseIf (resume = 0) {}
    randomNumbers = g_objAPI.LMSGetValue('cmi.comments').split(',');
    slideViews = objCP.cpEIGetValue ('scenarioNumber');
    resume ++;
    jumpSlide();
    }
    else {}
    jumpSlide();
    }
    };

    The random slide order is stored in cmi.comments, and the position in the sequence is stored in a Captivate variable called scenarioNumber. I could have stored the two variables of Captivate in cmi.suspend_data, but in the end, I liked being able to see the numbers when considering the SCORM data. To work around problems with initialization, I made the creation/restoration of the part of random numbers of the function which climbs to a slide randomly, so nothing is actually executed when entering the first slide.

  • Add a watermark with fields with JavaScript / c#

    I want to add a watermark with JS method addWatermarkFromFile. The watermak is a PDF file that has fields where I can enter some information (user name, date, time, for example) and save it in the file watermak. If I use the Add Watermak in Acrobat X window, the contents of the fields appears in the watermark on the files. However, if I use JS this.addWatermarkFromFile (...) (that this either with all the parameters of seizures, or simply use a para the full path of the file watermark), watermak can be added, but the fields are completely absent. What I miss in JS? Thank you.

    PS please don't tell me to use the dynamic buffer. All this will be done in c# finnally. Custom dynamic stamp does not work with c# as I expected.

    Yes, addWatermarkfromFile will not focus on the fields.

    That's why I recommend making TWO DISTINCT operations.

    (1) stamp in the main parts of PDF

    (2) the fields (i.e. create new text watermark, etc.)

    From: santa-satan [email protected]<>[email protected]>

    Reply-To: "[email protected]<>[email protected]> ' [email protected]<>[email protected]>" "

    Date: Wednesday, February 8, 2012 06:26:18-0800

    To: Leonard Rosenthol [email protected]<>[email protected]>

    Subject: Add a watermark with fields with JavaScript / c#

    Add a watermark with fields with JavaScript / c#

    created by santa-satanhttp://forums.adobe.com/people/santa-satan> in Acrobat SDK - see the discussion complete onhttp://forums.adobe.com/message/4193350#4193350

  • Accesing XFA data with javascript

    Hello everyone:

    I'm starting to develop pdf with LiveCycle Forms and I find a few problems getting the document info on author, file name, path, etc. with javascript. I read some books, but I can't find where to get this value. I tried xfa.datasets..., xfa.host..., xfa.form... without success.

    Any suggestions?

    Thanks for your time!

    Kind regards

    Javier

    Hello

    Here is an example show how to access the file name and path (don't worry the button): https://acrobat.com/#d=ZnxO-dlXXFDS0GvYcQk2NQ

    You can access the metadata, the properties of the form, but I need to dig up a script. Perhaps a search on the forum.

    Hope that helps,

    Niall

    Ensure the dynamics

  • How to evaluate the blend if settings with javascript

    Some time ago, someone in the MacIntosh forum declared their wish to use a layer result of the Layer Style mixture if parameter as a mask (for some reason any).

    "The layer of the ' this 'effect is easily converted to a mask by combining and flattening the layer and using the transparency resulting.

    «Underlying layer but the "'-setting seems harder (naturally because they depend on the content of the other layers).»

    Is there a way to get the current figures (for a RGB 32 file) blend If settings for a layer with JavaScript?

    Or is there a way to reset settings If This Layer-Blend, but leave unchanged the underlying layer settings?

    Any help appreciated.

    It seems I was mistaken. The merge options are not part of the layerEffects descriptor. At least not in CS4. There was a time where you had to use a script by Xbytor named Styles.js for the layerEffects descriptor. I tried as well, and also, she returns not all parameters of mixture.

    The Merge Options are stored as part of the Style When you save the Style as a preset or save it to disk as a .asl file. Take a look with a hex editor.

    This information has not been read in (via Styles.js) as part of the Style descriptor. I've updated Styles.js so that you can now get the mixture descriptor Options:

    http://PS-scripts.com/BB/viewtopic.php?t=2759

    X

  • My speed has decreased between the router and the modem is not working properly, what can I do to increase the download speed with my Time Capsule 802.11n

    My speed has decreased between the router and the modem is not working properly, what can I do to increase the download speed with my Time Capsule 802.11n

    A variety of phenomena can affect the performance of its wireless network. You may be able to mitigate some negative effects.

    Solutions to any factors that may have an impact on your wireless network, read use the Diagnostics wireless for you help to solve the problems of Wi-Fi on your Mac - Apple Support.

  • Is no longer able to view live on Alexei_tchernomor even content with javascript active.

    I had no problems until recently - has always been able to view their videos. I never had installed oracle java plug-in, but had javascript activated via subject: config and everything worked properly. Now, I am unable to view the videos on the site with javascript active. I use noscript and java is enabled in the options for this site. Any help would be appreciated. I have the site enabled in my firewall.

    I'm glad that you found the help page because I wasn't going to be able to answer that one.

  • Is it possible to work with JavaScript in JUST ONE TAB and not on others

    I usually browse websites with javascript is disabled. But sites like facebook and youtube need javascript. So what I really want is to just run these sites on legs with active javascript and run the other tabs without it.

    Try noscript. It can be a pain to get the installer at the beginning because you need allow all areas that you want to allow JavaScript for, but that market either tabs or windows.

    https://addons.Mozilla.org/en-us/Firefox/addon/NoScript/

  • Create wireless network with airport Time Capsule

    I replace my ISP provider rented the modem / router with a modem, I bought and I would use my gen current airport Time Capsule to set up the wifi network. I can't find the instructions on how to proceed and AirPort Extreme do not seem to apply.

    I am running OS X Capitan 10.11.3 on an early 2015 MacBook Pro.

    Thank you!

    Dale

    I can't find the instructions on how to proceed and AirPort Extreme do not seem to apply.

    Hmm.  A time Capsule is an AirPort Extreme with a built-in hard drive, so what works for one should work for the other and vice versa. You might be looking at old operating instructions?

    Since you've decided to add a new modem, Time Capsule will be reset back to the default settings and then set it up again to work with the new modem.  Apple installation "wizard" will guide you in installing the time Capsule, by appointing a wireless network, set up a password, etc, so the process is very easy to name.

    The installation provided with your Time Capsule Guide goes on how to set up the time Capsule.

    After resetting the time Capsule to factory default settings, you would connect an Ethernet cable from the modem into the "O" on the Time Capsule WAN port.

    To get the "Assistant" Setup running, just click the WiFi icon at the top of the screen of the Mac and are looking for the new AirPort base station. Just below that, click directly on the Time Capsule.  The example below shows an AirPort Extreme, but you would see on your screen time Capsule.

    When you click on the Time Capsule, the next screen that is displayed looks like this, except that you will see a picture of a Capsule of time on your screen.

    Simply click next to get the process going and follow the instructions.

  • I have the network wireless with an extreme airport using my base station that dessert 4 Airport expresses. I want to replace the base station with a time capsule from apple.  Are there specific instructions other that connect the new time capsule

    I have a wired to the internet using my base station for 4 expresses the hard extreme airport.  I want to replace the base station with a time capsule.

    It is also easy to replace the existing base station and adding the name of the network and the password?

    You should be able to transfer your configuration of your current access point to new, and then you would just set up the internal drive, try to look at these articles:

    ith-new http://www.TechRepublic.com/article/apples-Airport-extreme-out-with-the-old-in-w.

    -one-airport-extreme-or-time-capsule-to-http://www.iclarified.com/31189/How-to-Transfer-Your-configuration-settings-fromanother

  • I have an installed with real-time PXI-8109 module. Displays the indicator USER1?

    Hi all

    I have an installed with real-time PXI-8109 module.

    USER1 indicator LED displays on the Panel?

    Thank you

    The LEDs of the user are the indicators that you can control programmatically if needed be.

    -Jayk

  • I have problems with my computer with the time remaining after I reset the clock and made sure it was on the correct time zone and summer time has been check the battery has also been replaced

    and it will not keep the exact time it will keep accelerate at least 5 minutes or more.

    I don't know what else to do about it. You can someone help me?

    I still find myself make too many assumptions.
    First of all, I guess your derivative of clock occurs during the time when the computer is running and not during the period where it is off (or immediately early)?
    Second, I'm assuming that when you run the command "w32tm/Resync" above, the clock made it back to the correct time and no errors were reported?
    Third, you say that your clock drift 5 minutes or more, but you do not tell us how long this gain occurs.  It is two times more win if you wait twice as long to check?  Is the gain gradual or sudden?  Keep he wins or if he stops wins once it arrives before?

    Conditions of default for a computer connected non-member of the field, the time will be updated network-time only at the start and then once a week.  If you are winning too much too quickly, you can adjust how many times your computer asks for time.  Computers in the domain must be more precise and one every hour for a default time synchronization.  You can set your W32tm to that of a computer in the domain to resynchronize your computer more often (SpecialPollInterval).  Here are two articles that describe the clock settings:

    "How to synchronize the time with the time service Windows in Windows XP"
      <>http://support.Microsoft.com/kb/307897 >
    "Time Windows Services tools and settings.
      <>http://TechNet.Microsoft.com/en-us/library/cc773263%28V=WS.10%29.aspx >

    HTH,
    JW

Maybe you are looking for

  • Canon XF300 MXF import

    Hi all I did a search of the forum, but it doesn't seem to be something recent or real conclusive on the importation of MXF. I need to import about 6 hours of type MXF footage in FCX in about 10 days or find another camera. My understanding is that I

  • BlackBerry 10 how update the OS using the Mobile network?

    Hello... I recently bought the Z3 that came with OS version 10.2.1.3412 and SR 10.2.1.3054.Now the device demonstrates that this new update is available which is SR 10.3.2.2474.I don't have a Wi - Fi connection, I also tried updating via BlackBerry L

  • How to use wifi at home and the office without changing the configuration

    I use a connection Wi - Fi through a large modem broadband at home. I want to use Wi - Fi in my office too. My office, Wi - Fi is through the proxy server and firewall must provide the proxy details. When there is also this information is not require

  • BlackBerry browser google smartphones in ' go to ' option displays blank page loading.

    Hello, I am a newbie in the world of blackberry. I just got my friends, the Bold 9700 for my engagement present. I use it for a form of the week. I am Malaysian and I use the DiGi carrier. At first, everything goes smoothly, web browsing is excellent

  • Cannot create Outlook account.

    I managed to synchronize my google account, yahoo & hotmail for my RT Surface. Unfortunately, when I add my Outlook account it invites "unable to connect. Make sure that the information you entered is correct. "I add the news like e-mail address, add