...

View Full Version : Javascript With CSS



As5a5sIn5
08-09-2004, 07:36 PM
Okay I can't make anything change dynamically without using a form input...how can I do this with CSS instead... A link to a tuorial or breif explaination would be great

Thanks In Advance

sad69
08-09-2004, 08:43 PM
Not sure what you're trying to change dynamically...

Sadiq.

As5a5sIn5
08-09-2004, 09:30 PM
A Clock
Heres Example:


CSS>>>
<body onLoad="show5()">
<span id="liveclock" style="position:absolute;left:0;top:0;">
</span>


JS>>>
<script language="JavaScript">
function show5(){
if (!document.layers&&!document.all)
return;
var Digital=new Date();
var hours=Digital.getHours();
var minutes=Digital.getMinutes();
var seconds=Digital.getSeconds();
var dn="AM";
if (hours>12){
dn="PM";
hours=hours-12;
}
if (hours==0)
hours=12;
if (minutes<=9)
minutes="0"+minutes;
if (seconds<=9)
seconds="0"+seconds;
myclock="<font size='5' face='Arial' ><b><font size='1'>Current Time:</font></br>"+hours+":"+minutes+":"
+seconds+" "+dn+"</b></font>";
if (document.layers){
document.layers.liveclock.document.write(myclock);
document.layers.liveclock.document.close();
}
else if (document.all)
liveclock.innerHTML=myclock;
setTimeout("show5()",1000);
}
</script>

C They SomeHow Combine To View On The Page Without Forms...

SpiritualStorms
08-10-2004, 06:22 AM
I have several questions: First, why do you include additional formatting within the function itself instead of just having a class that references a definition?

Secondly, how will your function know where to target its goals? You have this in your function:



if (document.layers){
document.layers.liveclock.document.write(myclock);
document.layers.liveclock.document.close();
}
else if (document.all)
liveclock.innerHTML=myclock;
setTimeout("show5()",1000);
}


I am no expert, but unless you do something like this,



var obj=document.getElementById( "liveclick" );


there's no gaurantee that your function will understand what liveclock is.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum