Arguments in setInterval (javascript)

Ok, I am really confused here. I haven’t worked much with setInterval in Javascript, but I assumed it worked the same as it does in Actionscript, but apparently it doesn’t.

This works in Flash…
[AS]function notify(m) {
trace(m);
}
setInterval(notify, 2000, “hello world”);[/AS]

This doesn’t work in Javascript…

function notify(m) {
	alert(m);
}
setInterval(notify, 2000, "hello world");

I checked the O’Reilly Reference in my Dreamweaver and it says in there that you pass the arguments at the end like I did there, but it just isn’t working!

Anyone know what I am doing wrong?

not sure if this helps…

http://www.insidedhtml.com/tips/functions/ts18/page4.asp

is there a setInterval? Ive always used setTimeout
Im so behind in my javascript. :stuck_out_tongue:

Jubba: THAT LINK WAS PERFECT!!! Man I searched for 2 hours last night and didn’t find ANYTHING that helped me.

Apparently Netscape does it right and IE doesn’t… how ironic :stuck_out_tongue:

Anywho, this works in both Netscape and IE

<SCRIPT LANGUAGE="JavaScript">
<!--
function notify(m, m2) {
    alert(m+" "+m2);
}
setInterval("notify('hello world', 'are you there?')" , 2000);
-->
</SCRIPT>

Sen: Yeah setInterval exists in Javascript :slight_smile:

4 minutes on google :slight_smile:

:stuck_out_tongue:

:trout:

yeah, it has to be in " "… i too was kinda confused by that… i noticed though that JS’s built-in functions/methods do not need the " " outside them … :slight_smile:

*Originally posted by Jubba *
**4 minutes on google :slight_smile:

:stuck_out_tongue:

:trout: **

Google must hate me because that’s what I was using too :-\