PHP and Javascript seconds problem
<?php if($endtime <= time()) { echo "<script type=\"text/javascript\"> function changedetails() { alert(\"Hello World!\"); } </script>" . "<script type=\"text/javascript\"> changedetails(); </script>"; } else { $timeleft = $endtime + 1 - time(); echo "<script type=\"text/javascript\"> var trainleft = " . $timeleft . "; function changedetails() { var timeh = Math.floor(timeleft / 3600); var timem = Math.floor((timeleft - (timeh * 3600)) / 60); var times = Math.floor(timeleft - (timeh * 3600) - (timem * 60)); if(timeleft < 0) { window.location = \"index.php\" } if(times >= 10) { if(timem >= 10) { document.getElementById('" . $itemdiv . "').innerHTML = timeh + \":\" + timem + \":\" + times; } else { document.getElementById('" . $itemdiv . "').innerHTML = trainh + \":0\" + trainm + \":\" + trains; } } else { if(timem >= 10) { document.getElementById('" . $itemdiv . "').innerHTML = timeh + \":\" + timem + \":0\" + times; } else { document.getElementById('" . $itemdiv . "').innerHTML = timeh + \":0\" + timem + \":0\" + times; } } timeleft = timeleft - 1; timerg = setTimeout('changedetails()', 1000); } function timerg_clear() { clearTimeout(timerg); } </script>" . "<script type=\"text/javascript\"> changedetails(); </script>"; } ?> |
Ask the Internet Marketing Geek <-- Happy to help with technical challenges
MiniSiteMaker.org <-- Free software to make your mini-sites fast and easy
TutorialsWindow: The online tutorials database
A sample page: The best Photoshop tutorials
Easy email marketing automation without moving your lists.
TutorialsWindow: The online tutorials database
A sample page: The best Photoshop tutorials
TutorialsWindow: The online tutorials database
A sample page: The best Photoshop tutorials