|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
JavaScript-Countdown via perl script?
Hi,
i do have no knowledge about javascript - based on this i need some help for the following: Let's say i have a perl routine with a saved time splitted into the variables $days, $hours, $mins ... Now i want to display on the html-output of the perl-script anywhere a live countdown like: Countdown: ------------------------------- |days|hours|minutes|seconds| ------------------------------- Would be great if anyone could create me a short snippet how i could insert anything like this ... Thanks! |
|
#2
|
|||
|
|||
|
From your perl/cgi script, you should write the whole document.
print <<END_OF_PAGE; <html><head>...</head><body> ........ all the content..... $day , $hour , etc. ... </body></html> END_OF_PAGE Using this (being a perl/cgi newbie -- started to learn today, lol) I dont know if the time could be updated, unless you use javascript. I'm not sure if defining the javascript variables with the perl variables will work though, but you can give it a try. print <<END_OF_PAGE; <html><head><script language="javascript"> var secs=$seconds function updateSec() { secs++; document.write(secs); SecsTimeout=setTimeout("updateSec()",1000) } updateSec() </script><body>..</body></html> END_OF_PAGE |
![]() |
| Viewing: Dev Shed Forums > Web Design > JavaScript Development > JavaScript-Countdown via perl script? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|