Page 1 of 1

Javascript setTimeout() issue

Posted: Mon Aug 12, 2002 2:36 am
by daemorhedron
I've got a weird issue with using a setTimeout() call. If I place the following code in to a HTML doc, it works fine.

Code: Select all

<html>
<head>
<script language="Javascript">
function dt() &#123;
	t=new Date();
	window.status=t.toString();
	setTimeout("dt()",1000);
&#125;

dt();
</script>
</head>
<body>
</body>
</html>
That's all well and good, but I don't like seeing my js in the html source for when I am debugging (weird I know). So I would change it to

Code: Select all

<html>
<head>
<script language="Javascript" src="/path/to/myscript.js">
</head>
<body>
</body>
</html>
The problem is when I do that, the script loads, but the actual timer fails. Can anyone tell me why, or offer advice on how to overcome this without having to include() all my js scripts?

TIA. =)

Posted: Mon Aug 12, 2002 5:36 am
by daemorhedron
omg shameful. turns out I was including some js code that had a function called status() in it. not one of my finer moments, but this is why you should get some sleep once in a while all you c0ders!

=)

Posted: Mon Aug 26, 2002 1:15 am
by Takuma
lol... zzzzZZZZZZ :lol: