Hello, this is what happens, I will put the problem the simplest way I can
<script type="text/javascript">
/* drawing lines and other stuff*/ my_function();
function my_function(){
document.write("hello");
}
</script>
This work fine, hello is written over everything I draw before
Now I replace
<script type="text/javascript">
/* drawing lines and other stuff*/ setTimeout("my_function()",1000);
function my_function(){
document.write("hello");
}
</script>
On this case everything disapears and hello is written over a blank page
the question is: WHY??????
I need to fix that somehow
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
</head>
<body onload="my_function();">
<div id="fred" style="width:400px;height:100px;border:solid black 1px;">
</div>
<script type="text/javascript">
/* drawing lines and other stuff*/
function my_function(){
document.getElementById('fred').innerHTML+=document.getElementById('fred').innerHTML+'document.write can only be used when the page is first rendered<br>';
setTimeout("my_function()",1000);
}
</script>
</html>
well, I was looking for a generic solution, since my objective is not to do a document.write, but to update graphics every second using a graphic library
Bookmarks