PDA

View Full Version : Live Date Time Script Not Working On Web Page



Tony S.
09-08-2009, 03:28 PM
1) Script Title: Live Date Time Script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex6/clock3.htm

3) Describe problem: Hello,
How is everyone doing today? I hope all here are well.
As you know by now I am very new to coding of any kind but have been able to get the help i need from members at this forum. I am very thankful,
It seems i need your help again. The problem I am havind is that I have been attemting to add a Date/Time JavaScript To my web page without any success. What happens is when I paste the code into my source page the script is visble but after I try to save the code to that page the code vanishes leaving only a small remenent of the code on the page, needless to say the Date/Time is not displated on my web page. I have put the JavaScript here for your inspection also a portion of my page sorce code after I have tried to save the Date/Time script there. Can any one tell me what i need to do to have this script work on my web page.
I am using cPanel to host my web page. They are set up to accept JavaScript so I don't know why the script disapears of the page.
This is the Date/ Time script



<script>

/*
Live Date Script-
Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions, 100's more DHTML scripts, and Terms Of Use,
visit http://www.dynamicdrive.com
*/


var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thu rsday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May"," June","July","August","September","October","Novem ber","December")

function getthedate(){
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var dn="AM"
if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
//change font size here
var cdate="<small><font color='000000' face='Arial'><b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+" "+hours+":"+minutes+":"+seconds+" "+dn
+"</b></font></small>"
if (document.all)
document.all.clock.innerHTML=cdate
else if (document.getElementById)
document.getElementById("clock").innerHTML=cdate
else
document.write(cdate)
}
if (!document.all&&!document.getElementById)
getthedate()
function goforit(){
if (document.all||document.getElementById)
setInterval("getthedate()",1000)
}

</script>
<span id="clock"></span>


Here Is what my web page source code looks like after i have pasted and tried to save the script to the page:




<p align="center"><font size="4"><a href="/ohbm/user_login.php"><strong><font color="#000033">Login</font></strong></a> <a href="/ohbm/user_registration.php?packageval=c4ca4238a0b923820 dcc509a6f75849b"><strong><font color="#000033">Sign-Up</font></strong></a> <a href="/ohbm/Pages/Affiliates.html"><strong><font color="#000033">Affiliates</font></strong></a> <a href="/ohbm/Pages/Directory.html"><strong><font color="#000066">Submit A Site</font></strong></a> <a href="/ohbm/Pages/Terms.html"><strong><font color="#000033">Terms</font></strong></a> <a href="mailto:tony@sasonlinebusinesssuccess.com"><s trong><font color="#000066">Contact Us</font></strong></a></font></p><p align="center" /><hr /><p /><p align="center"><em><strong>A Online Home Business Can Easily Make You Rich!!!</strong></em></p><h1 align="center"><font color="#ff0000">&quot;Yes, A Online Home Business Can Easily Earn You Six Figures A Year Fast<br />At Long Last, You Can Now Get Big Profits From You Own Online Business, Full Or Part Time<br />With Proven Methods, Tactics And Hot Selling Products<br />I Can Quickly And Easily Show You How&quot;</font></h1><p align="justify"><font size="4"></font></p><p /><p align="justify"><font size="4"></font></p><p /><p align="justify"><font size="4"></font></p><p /><p><font size="4"></font></p><p><font size="4"></font></p><p align="justify"><font size="4"></font></p><p align="justify"><font size="4"></font></p><p /><p align="justify"><font size="4"></font></p><p align="justify"><font size="4"></font></p><p align="justify"><font size="4"></font></p><p /><p align="justify"><font size="4"></font></p><p align="justify"><font size="4"></font></p><p align="justify"><font size="4"></font></p><p align="justify"><font size="4"></font></p><p align="justify"><font size="4"></font></p><p align="justify"><font size="4"></font></p><p align="justify"><font size="4"><table align="center" style="WIDTH: 500px" border="0" cellspacing="1" cellpadding="1"><tbody><tr><td></td></tr></tbody></table></font></p><p align="justify"><font size="4">From The Desk Of: <em><strong>Tony Sanford</strong></em> </font></p><p align="justify"><font size="4">Date: <script>

/*
Live Date Script-
Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions, 100's more DHTML scripts, and Terms Of Use,
visit http://www.dynamicdrive.com
*/


var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thu rsday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May"," June","July","August","September","October","Novem ber","December")

function getthedate(){
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var dn="AM"
if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
//change font size here
var cdate="<small><font color='000000' face='Arial'><b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+" "+hours+":"+minutes+":"+seconds+" "+dn
+"</b></font></small>"
if (document.all)
document.all.clock.innerHTML=cdate
else if (document.getElementById)
document.getElementById("clock").innerHTML=cdate
else
document.write(cdate)
}
if (!document.all&&!document.getElementById)
getthedate()
function goforit(){
if (document.all||document.getElementById)
setInterval("getthedate()",1000)
}

</script>
<span id="clock"></span></font></p><p align="justify"><font size="4">Dear Fellow Internet Marketer,</font></p><p align="justify">



My Source Code Page After I tried to Save The Date/Time Script:




<p align="center"><font size="4"><a href="/ohbm/user_login.php"><strong><font color="#000033">Login</font></strong></a> <a href="/ohbm/user_registration.php?packageval=c4ca4238a0b923820 dcc509a6f75849b"><strong><font color="#000033">Sign-Up</font></strong></a> <a href="/ohbm/Pages/Affiliates.html"><strong><font color="#000033">Affiliates</font></strong></a> <a href="/ohbm/Pages/Directory.html"><strong><font color="#000066">Submit A Site</font></strong></a> <a href="/ohbm/Pages/Terms.html"><strong><font color="#000033">Terms</font></strong></a> <a href="mailto:tony@sasonlinebusinesssuccess.com"><s trong><font color="#000066">Contact Us</font></strong></a></font></p><p align="center" /><hr /><p /><p align="center"><em><strong>A Online Home Business Can Easily Make You Rich!!!</strong></em></p><h1 align="center"><font color="#ff0000">&quot;Yes, A Online Home Business Can Easily Earn You Six Figures A Year Fast<br />At Long Last, You Can Now Get Big Profits From You Own Online Business, Full Or Part Time<br />With Proven Methods, Tactics And Hot Selling Products<br />I Can Quickly And Easily Show You How&quot;</font></h1><p align="justify"><font size="4"></font></p><p /><p align="justify"><font size="4"></font></p><p /><p align="justify"><font size="4"></font></p><p /><p><font size="4"></font></p><p><font size="4"></font></p><p align="justify"><font size="4"></font></p><p align="justify"><font size="4"></font></p><p /><p align="justify"><font size="4"></font></p><p align="justify"><font size="4"></font></p><p align="justify"><font size="4"></font></p><p /><p align="justify"><font size="4"></font></p><p align="justify"><font size="4"></font></p><p align="justify"><font size="4"></font></p><p align="justify"><font size="4"></font></p><p align="justify"><font size="4"></font></p><p align="justify"><font size="4"></font></p><p align="justify"><font size="4"><table align="center" style="WIDTH: 500px" border="0" cellspacing="1" cellpadding="1"><tbody><tr><td></td></tr></tbody></table></font></p><p align="justify"><font size="4">From The Desk Of: <em><strong>Tony Sanford</strong></em> </font></p><p align="justify"><font size="4">Date:<script></script> <span id="clock"></span></font></p><p align="justify">



I know it is a lot to look at but I hope you can help me figure this one out.

Thank you
Tony S.

ddadmin
09-09-2009, 06:55 AM
The two versions don't look that different actually, and should still work. Do you have a URL to the actual problem page we can look at?

Tony S.
09-09-2009, 02:54 PM
Yes, You can view this page at: "http://www.sasonlinebusinesssuccess.com/ohbm"

I hope this can help, I really would like to use this script. :)