|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
CF/Javascript
I have this code... and it displays a dynamic clock on the title of the page... can someone help me change it so it just displays it on tehe body of a regular CF page? i know absolutely no javascript..
<script> function getClock() { document.title= updateClock(); // make a call to the updateClock() function to return the current time value } // this function uses settimeout function function updateClock() { var now = new Date(); var clock = setTimeout("getClock()", 1000); //update getClock() function ////////////////////////////////////////// clock = now.getMonth()+1 + "/" + now.getDate() + "/" + now.getYear() + "-" + now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds(); ////////////////////////////////////////// return clock; } // this is more like an endless loop where two functions call each other </script> <!----------------------------------------------------------------------> <body onLoad="getClock()"> <h2> Watch the title on your page. See time slip out of your hands ! </h2> |
|
#2
|
|||
|
|||
|
Charmed -- I belive that we are missing some code here. The javascript that you've posted is the "clock", but there is no code that I see that tells your browser "where" to display the clock.
<body onLoad="getClock()"> That line tells the clock to start running, but there *has* to be code that displays the clock. This clock is on the page's title bar? So ... can you paste the <title> tag? |
|
#3
|
||||
|
||||
|
the initial contents of the title tag don't matter
document.title= updateClock(); // updates the title that said, i think this use of javascript is abysmal i don't need to visit a web site to find out what time it is ![]() |
|
#4
|
|||
|
|||
|
doh! I missed that line of code (document.title= updateClock()
the first time I read the post.Charmed -- you simply need to change this part document.title= updateClock(); to update the portion of the page that you want to have the clock. Something along the linest of ... document.all.nameOftheSpanThatHasTheClock = updateClock(); |
|
#5
|
|||
|
|||
|
I posted i didnt know any javascript so is there any chance i can get a little more help on this? i just want the clock displayed on the page not the title.. i dont know what that line even means, so i dont know how to change it... i pasted what you put but it just takes it off the title, but doesnt put it on the page
Quote:
|
|
#6
|
|||
|
|||
|
There's a whole forum on Javascript development here at Devshed, you might want to ask there.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > CF/Javascript |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|