below is my external javascript code and testing page.
for this im just using settimeout to loop increment and write out a value.
on the first loop everything works corrrectly.
on the second loop everything gets erased and only displays the text i wrote.
i can run other scripts fine like this. (ie changing the background randomly)
why does document.write erase my page? im just beginning to learn this scripting language.
Thanks
var iCount = 1;
function Main(){
Writer();
Loop();
}
function Writer(){
document.open();
document.write(iCount++);
document.close();
iCount++;
}
function Loop(){
return window.setTimeout(Main,1000);
}
Main();
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<p>
<script src="da.js" type="text/javascript">
</script></p>
</body>
</html>