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
My Source Code Page After I tried to Save The Date/Time Script:
Code:
<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=c4ca4238a0b923820dcc509a6f75849b"><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"><strong><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">"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"</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.
I know there are a lot of websites on the internet.
And I know there is old and new information.
The problem is, the old information doesn't tell you about the new information.
You kind of have to just keep up with it.
Your HTML is missing parts and the parts that you do have are old and out dated.
You need to update, start using style sheets and get rid of old depreciated tags.
I rewrote and reorganized your code so it is more up to date.
I added the HTML, HEAD and BODY tags.
I added a style sheet and removed depreciated tags.
Then I put your Javascript inside the HEAD element.
I think you will find that everything works now.
HTML Code:
<html><head><style>
.container
{
text-align:center;
}
.nav_span
{
color:#003;
font-size:18;
font-weight:bold;
margin-right:10px;
}
hr
{
margin-top:15px;
margin-bottom:20px;
}
.headline
{
font-size:2em;
font-weight:bold;
color:#f00;
margin-top:20px;
}
.signiture
{
font-size:18;
text-align:justify;
margin-top:30px;
}
.date
{
font-size:18;
text-align:justify;
margin-top:10px;
}
#clock{font-weight:bold;}
</style><script>
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","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=dayarray[day]+", "+montharray[month]+" "+daym+", "+year+" "+hours+":"+minutes+":"+seconds+" "+dn
if(document.all){document.all.clock.innerHTML=cdate}
else if(document.getElementById){document.getElementById("clock").innerHTML=cdate}
else{document.write(cdate)}
}
setInterval("getthedate()",1000)
</script></head><body><div class="container"><a href="/ohbm/user_login.php"><span class="nav_span">Login</span></a><a href="/ohbm/user_registration.php?packageval=c4ca4238a0b923820dcc509a6f75849b"><span class="nav_span">Sign-Up</span></a><a href="/ohbm/Pages/Affiliates.html"><span class="nav_span">Affiliates</span></a><a href="/ohbm/Pages/Directory.html"><span class="nav_span">Submit A Site</span></a><a href="/ohbm/Pages/Terms.html"><span class="nav_span">Terms</span></a><a href="mailto:tony@sasonlinebusinesssuccess.com"><span class="nav_span">Contact Us</span></a></div><hr><div class="container"><em><strong>An Online Home Business Can Easily Make You Rich!!!</strong></em></div><div class="container headline">"Yes, An Online Home Business Can Easily Earn You Six Figures A Year - Fast<br />At Long Last, You Can Now Get Big Profits From Your 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"</div><div class="signiture">From The Desk Of: <em><strong>Tony Sanford</strong></em></div><div class="date">Date: <span id="clock"></span></div></body></html>
Hi,
I want to thank you all for all of your help and support with my script problem. You all are truly amazing and I appreciate your time and effort in helping me. I will take all of your advice also take the information as a learning experience hopefully I will be able to help some one else one day.
Hi,
I am back I have tried the solutions given above and none of them seem to work for me. So I now ask if there any reasons why javasript will not work on a webpage. Could there be a browser settings problem or other web page or settings problem that won't allow the script to work on that particular page?
Can anyone help?
Hi wirehopper,
i belive javasript is active. How would I check to make sure?
I copy and paste the code from my Windows notepad.
when I check view source the script is there untill I try to save that page then it seems to leave the page some how.
Any Ideas?
Also note that if a single character is wrong in a script, so you get a syntax error, it can completely crash all scripts on that page. Use the JavaScropt console (Ctrl+Shift+J in FF) or Firebug for FF to see these errors.
Always have reference material near at hand when coding, look in my signature for a few.
Is there any setting on my PC that I may be missing or not working that could cause JavaSript not to work on my web pages? I am using "Windows vista home premium 64 bit" OS.