...

View Full Version : Help on coding a Scritp Code



brokendownhitle
12-19-2006, 02:13 PM
I was wondering if someone can help me code this javascrpit code


<script type="JavaScript">

var elbow = new Date();
var rib = elbow.getSeconds();

if (rib<=30) rib=Yes;
else if (rib<=60) rib=No;
var msg ="+rib+";
document.write(msg);

</script>

coothead
12-19-2006, 03:01 PM
Hi there brokendownhitle,

and a warm welcome to these forums. ;)

I would suggest that you do not use document.write.

source:-

http://www.w3.org/TR/2004/WD-WCAG20-SCRIPT-TECHS-20041119/#doc-write


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script type="text/javascript">
window.onload=function() {
var elbow=new Date();
var rib=elbow.getSeconds();

if(rib<=30){
rib='Yes';
}
else {
if(rib<=60){
rib='No';
}
}
document.getElementById('msg').firstChild.nodeValue=rib;
}
</script>

</head>
<body>

<div id="msg">&nbsp;</div>

</body>
</html>

coothead

rubenbuhr
12-19-2006, 03:48 PM
I would suggest that you do not use document.write.

It just keeps getting easier, :rolleyes:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum