...

View Full Version : Requesting help with setInterval and if...then statement



Margaret
03-22-2004, 05:50 PM
I want to create a status bar message that turns off and on repeatedly using:

1. the setInterval() method and
2. an if...then statement

This is my code, but it does not work. I do not understand how to employ an if...then statement in this situation. Thank you for your help.



<HTML>
<HEAD>
<TITLE>Flash Greeting</TITLE>

<SCRIPT LANGUAGE="JavaScript">
<!--HIDE FROM NON JS BROWSERS

var statusMsg

statusMsg=window.setInterval("defaultStatus='This blinking message is annoying, is it not?';",2000);



//STOP HIDING-->

</SCRIPT>
</HEAD>


<BODY>
</BODY>
</HTML>

lavalamp
03-22-2004, 06:46 PM
Blink:

Margaret
03-22-2004, 07:25 PM
lavalamp,

Thank you for your help with this script. It works exactly as I need it. Your help is very much appreciated.

Margaret

lavalamp
03-22-2004, 07:47 PM
Happy to help. :)

GeForce
03-23-2004, 02:14 PM
Hi,

Just as an afterthought, you should also change this:

window.status=(window.status==statusMsg)?'':statusMsg;

for

window.status=(window.status==statusMsg)?' ':statusMsg;

This will make sure that it does not flash between statusMsg and "Done". The blank space I have added should solve this.

Jonathan:cool:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum