[Zope] question: javascript in zpt?
Roel Van den Bergh
roel@planetinterior.com
Wed, 12 Jun 2002 17:45:28 +0200
This is a multi-part message in MIME format.
------=_NextPart_000_0000_01C21238.F0A13340
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
I have a nice javascript that renders the time
works fine in dtml
How can I use this in zpt pages ?
For whom it might want to use it the javascript is attached
TIA, R.
------=_NextPart_000_0000_01C21238.F0A13340
Content-Type: text/plain;
name="clock.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="clock.txt"
<script language=3DJavascript1.2>
<!--
if(navigator.appName =3D=3D "Netscape") {
document.write('<layer id=3D"clock"></layer><br>');
}
if (navigator.appVersion.indexOf("MSIE") !=3D -1){
document.write('<span id=3D"clock"></span>');
}
DaysofWeek =3D new Array()
DaysofWeek[0]=3D"Sunday"
DaysofWeek[1]=3D"Monday"
DaysofWeek[2]=3D"Tuesday"
DaysofWeek[3]=3D"Wednesday"
DaysofWeek[4]=3D"Thursday"
DaysofWeek[5]=3D"Friday"
DaysofWeek[6]=3D"Saturday"
Months =3D new Array()
Months[0]=3D"January"
Months[1]=3D"February"
Months[2]=3D"March"
Months[3]=3D"April"
Months[4]=3D"May"
Months[5]=3D"June"
Months[6]=3D"July"
Months[7]=3D"August"
Months[8]=3D"September"
Months[9]=3D"October"
Months[10]=3D"November"
Months[11]=3D"December"
function upclock(){
var dte =3D new Date();
var hrs =3D dte.getHours();
var min =3D dte.getMinutes();
var sec =3D dte.getSeconds();
var day =3D DaysofWeek[dte.getDay()]
var date =3D dte.getDate()
var month =3D Months[dte.getMonth()]
var year =3D dte.getFullYear()
var col =3D ":";
var spc =3D " ";
var com =3D ",";
var apm;
if (date =3D=3D 1 || date =3D=3D 21 || date =3D=3D 31)
{ender =3D "<sup>st</sup>"}
else
if (date =3D=3D 2 || date =3D=3D 22)
{ender =3D "<sup>nd</sup>"}
else
if (date =3D=3D 3 || date =3D=3D 23)
{ender =3D "<sup>rd</sup>"}
else
{ender =3D "<sup>th</sup>"}
if (12 < hrs) {
apm=3D"pm";
hrs-=3D12;
}
else {
apm=3D"am";
}
if (hrs =3D=3D 0) hrs=3D12;
if (hrs<=3D9) hrs=3D"0"+hrs;
if (min<=3D9) min=3D"0"+min;
if (sec<=3D9) sec=3D"0"+sec;
if(navigator.appName =3D=3D "Netscape") {
document.clock.document.write(day+spc+date+ender+spc+month+spc+year+spc+h=
rs+col+min+col+sec+spc+apm);
document.clock.document.close();
}
if (navigator.appVersion.indexOf("MSIE") !=3D -1){
clock.innerHTML =3D =
day+spc+date+ender+spc+month+spc+year+spc+hrs+col+min+col+sec+spc+apm;
}
}
setInterval("upclock()",1000);
//-->
</script>
------=_NextPart_000_0000_01C21238.F0A13340--