I have two javscripts where one displays the time, and the other uses cookies to store as a notepad. ( I didn't write these myself)
the clock:
<script> function show2(){
if (!document.all&&!document.getElementById)
return
thelement=document.getElementById? document.getElementById("clock"): document.all.clock
var Digital=new Date()
var hours=Digital.getHours()
var minutes=Digital.getMinutes()
var seconds=Digital.getSeconds()
var dn="PM"
if (hours<12)
dn="AM"
if (hours>12)
hours=hours-12
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
var ctime=hours+":"+minutes+":"+seconds+" "+dn
thelement.innerHTML=Digital.getMonth()+"."+Digital.getDate()+"."+Digital.getYear()+" | "+ctime
setTimeout("show2()",1000)
}
window.onload=show2
</script>
body call:
<div id="clock"></div>
----------------------------
the notes:
<script>
function ReadCookie (Name)
{
var search = Name + "="
if (document.cookie.length > 0)
{
offset = document.cookie.indexOf(search)
if (offset != -1)
{
offset += search.length
end = document.cookie.indexOf(";", offset)
if (end == -1)
end = document.cookie.length
return (document.cookie.substring(offset, end))
}
else
return ("");
}
else
return ("");
}
function WriteCookie (cookieName, cookieValue, expiry)
{
var expDate = new Date();
expDate.setTime (expDate.getTime() + expiry);
document.cookie = cookieName + "=" + escape (cookieValue) + "; expires=" + expDate.toGMTString() + "; path=/";
}
function getCookies()
{
document.noteForm.note.value = unescape(ReadCookie("note"));
}
</script>
body call:
<script>window.onload=function() { getCookies(); }</script>
I have no problem with the two script seperatly, but when I add the last script into the page, nothing works.
I know this may seem confusing, but is there anything I can change to get them both to work fine?
the clock:
<script> function show2(){
if (!document.all&&!document.getElementById)
return
thelement=document.getElementById? document.getElementById("clock"): document.all.clock
var Digital=new Date()
var hours=Digital.getHours()
var minutes=Digital.getMinutes()
var seconds=Digital.getSeconds()
var dn="PM"
if (hours<12)
dn="AM"
if (hours>12)
hours=hours-12
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
var ctime=hours+":"+minutes+":"+seconds+" "+dn
thelement.innerHTML=Digital.getMonth()+"."+Digital.getDate()+"."+Digital.getYear()+" | "+ctime
setTimeout("show2()",1000)
}
window.onload=show2
</script>
body call:
<div id="clock"></div>
----------------------------
the notes:
<script>
function ReadCookie (Name)
{
var search = Name + "="
if (document.cookie.length > 0)
{
offset = document.cookie.indexOf(search)
if (offset != -1)
{
offset += search.length
end = document.cookie.indexOf(";", offset)
if (end == -1)
end = document.cookie.length
return (document.cookie.substring(offset, end))
}
else
return ("");
}
else
return ("");
}
function WriteCookie (cookieName, cookieValue, expiry)
{
var expDate = new Date();
expDate.setTime (expDate.getTime() + expiry);
document.cookie = cookieName + "=" + escape (cookieValue) + "; expires=" + expDate.toGMTString() + "; path=/";
}
function getCookies()
{
document.noteForm.note.value = unescape(ReadCookie("note"));
}
</script>
body call:
<script>window.onload=function() { getCookies(); }</script>
I have no problem with the two script seperatly, but when I add the last script into the page, nothing works.
I know this may seem confusing, but is there anything I can change to get them both to work fine?