Well, hm, it not so simple to make a XHTML strict valid page (your code weas not valid at all for a thousands of reasons: elements must be nested in level elements (a, p, span, div)..., input must have and end code />, script must have a type, not a language, and it must be lower case, as all the tags and attributes), and it must be escape with a CDATA (to avoid let the interpretor take some javascript operator or characters - such as < > &... as XML mark-ups)... and so on.
On the other hand you should use getElementById() if your element has an id.
How here's a page which is strict XHTML valid:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<script type="text/javascript">
/* <![CDATA[ */
function startclock()
{
var thetime=new Date();
var nhours=thetime.getHours();
var nmins=thetime.getMinutes();
var nsecn=thetime.getSeconds();
if (nsecn<10)
nsecn="0"+nsecn;
if (nmins<10){
nmins="0"+nmins;
}
document.getElementById('clockspot').value=nhours+":"+nmins+":"+nsecn;
setTimeout('startclock()',1000);
}
onload=startclock
/* ]]> */
</script>
</head>
<body>
<table>
<tr>
<td>
<form action="clocktest.htm" id="clockform" style="display:inline">
<div>Current Time:</div>
<div><input type="text" style="text-align:center" id="clockspot" size="10" /></div>
</form>
</td>
</tr>
</table>
</body>
</html>