Javascript setTimeout() issue

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
daemorhedron
Forum Commoner
Posts: 52
Joined: Tue Jul 23, 2002 11:03 am

Javascript setTimeout() issue

Post 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. =)
daemorhedron
Forum Commoner
Posts: 52
Joined: Tue Jul 23, 2002 11:03 am

Post 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!

=)
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

lol... zzzzZZZZZZ :lol:
Post Reply