Submit article - Debt Consolidation - Submit Articles - HASP - Internet Businesses Online Articles

PDA

View Full Version : How to tell if this Timeout is working?


Jen-
Dec 2nd 2006, 5:41 am
Hello, I have a div on a timer below, but I don't know how to test if it is working. It is updating every 10 seconds, but since the text is the same, "test" nothing appears to be happening when it probably is. How can I add something to this so I can see some action every 10 seconds. I need to keep the div as the thing that is updating every 10. Thank you very much~~

<script type="text/javascript">
function change()
{
content = document.getElementById("content");
setTimeout('change()',10000);
}
</script>
</head>
<body>
<div class="main" style="border: 5px solid rgb(0, 0, 0);">
<div class="body">
<div id="content">test</div>
</div>
</div>
</body>
</html>

TechEvangelist
Dec 2nd 2006, 5:50 am
Errr... it's not doing anything right now. You have to call the change function before it does anything. I'm not sure what you are trying to do here.

When I'm trying to see if a function is working properly, I add an alert box with the JavaScript variables I'm monitoring. Add it on the line just after your setTimeout method. When you call the function, you should see the alert box pop up 10 seconds later.

Jen-
Dec 2nd 2006, 6:35 pm
The alert worked thanks.