Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Mar 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Requesting help with setInterval and if...then statement

    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>

  • #2
    Regular Coder
    Join Date
    Aug 2003
    Location
    Loughborough University
    Posts
    427
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Blink:
    Attached Files Attached Files
    AMD Athlon "Barton" XP 3200+ (11*200.5MHz = 2.2GHz)
    BFG GeForce 6800 Ultra OC 256Mb
    3 * Kingston 256Mb PC3200 DDR400
    Seagate Barracuda 120Gb Ultra ATA-100 and Seagate Barracuda 160Gb, SATA-150

  • #3
    New to the CF scene
    Join Date
    Mar 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    lavalamp,

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

    Margaret

  • #4
    Regular Coder
    Join Date
    Aug 2003
    Location
    Loughborough University
    Posts
    427
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Happy to help.
    AMD Athlon "Barton" XP 3200+ (11*200.5MHz = 2.2GHz)
    BFG GeForce 6800 Ultra OC 256Mb
    3 * Kingston 256Mb PC3200 DDR400
    Seagate Barracuda 120Gb Ultra ATA-100 and Seagate Barracuda 160Gb, SATA-150

  • #5
    New Coder
    Join Date
    Mar 2004
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    ====================
    Jon
    ====================


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •