shadowayex Posted May 12, 2008 Share Posted May 12, 2008 Ok. I'm trying to use setInterval() to make a chat box. But I didn't really know how to work it. So I tried to make a simple example. It looks like this: <html><head><title>Test</title><script type="text/javascript>setInterval("count()",1000)var time=1;function count(){ document.getElementById("test").innerHTML = ++t;}</script></head><body><div class="test"></div></body></html> It doesn't work. What am I doing wrong? Link to comment Share on other sites More sharing options...
justsomeguy Posted May 12, 2008 Share Posted May 12, 2008 The t variable doesn't exist. Link to comment Share on other sites More sharing options...
shadowayex Posted May 12, 2008 Author Share Posted May 12, 2008 Ah. variable fixed. Problem not. Still doesn't work. Link to comment Share on other sites More sharing options...
Synook Posted May 12, 2008 Share Posted May 12, 2008 <script type="text/javascript> No closing quote. Link to comment Share on other sites More sharing options...
shadowayex Posted May 12, 2008 Author Share Posted May 12, 2008 Ah ha. Quote fixed. Problem still not >_<. Link to comment Share on other sites More sharing options...
justsomeguy Posted May 12, 2008 Share Posted May 12, 2008 You should be using Firebug to check for Javascript errors. It's a lot faster then posting a message and waiting for an answer. You need an ID for the div. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.