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 15 of 15
  1. #1
    New Coder
    Join Date
    Jul 2002
    Location
    Indianapolis, Indiana
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Can Someone tell me what is wrong with this code?

    I have the following body tag on one of my websites. Everything has worked fine until I had to add the toggle command for some blinking text I needed on the page. (And before anyone says it.. Yes, I too hate blinking text... but I have having a terrible time getting people to read stuff.. and I am grasping at straws)

    Anyway, I am sure it has something to do with the way I have the toggle command in the onLoad section. I just dont know how to tie the various onLoad commands together.

    <body bgcolor="#FFFFFF" text="#000000" link="#26265F" vlink="#26265F" alink="#26265F" leftmargin="0" topmargin="0" rightmargin="0" marginwidth="0" marginheight="0"
    onLoad="toggle(); MM_preloadImages('images/homeOVER.gif','images/guestsOVER.gif','images/committeesOVER.gif', 'images/hotelOVER.gif','images/propsOVER.gif', 'images/photosOVER.gif','images/aboutOVER.gif','images/registerOVER.gif', 'images/dealersOVER.gif','images/charitiesOVER.gif','images/policiesOVER.gif',)">
    Thanks,

    Kim

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    The Netherlands, Baarn, Ut.
    Posts
    4,252
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Multiple onLoads, JS

    To combine multiple function calls in the unLoad event handler is decribed here.
    Since this is more of a JavaScript issue, i'll request a moderator to move the thread; please do not cross-post.
    Regards,
    Ronald.
    ronaldvanderwijden.com

  • #3
    Regular Coder
    Join Date
    Aug 2004
    Location
    The US of A
    Posts
    767
    Thanks
    1
    Thanked 0 Times in 0 Posts
    On another note, you might want to move the styling into a CSS file, or at least into a style attribute.

  • #4
    New Coder
    Join Date
    Jul 2002
    Location
    Indianapolis, Indiana
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Ronald. I should have posted it there, but it was late and I was tired. If someone can move it.. that would be great.

    In the mean time... I went to that link you provided and unfortuantely, that didnt help.

    The JavaScript works if ONLY the onLoad="toggle();" is listed. Once I add the MM_preloadImages 'images/homeOVER.gif', 'images/guestsOVER.gif', 'images/committeesOVER.gif', 'images/hotelOVER.gif', 'images/propsOVER.gif', 'images/photosOVER.gif', 'images/aboutOVER.gif', 'images/registerOVER.gif', 'images/dealersOVER.gif', 'images/charitiesOVER.gif', 'images/policiesOVER.gif',)" to the end of the statement.. making sure to delete the last set of quotes from the above toggle statement, it still doesnt make the text blink. If I remove all of the preloaded images script, the text will blink.

    If a moderator can move this to the appropriate place, I would appreciate it.

    Kim

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    we need the rest of your code, there is the possibility of another window.onload in the head part of your document

  • #6
    New Coder
    Join Date
    Jul 2002
    Location
    Indianapolis, Indiana
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    I guess the easiest way to see the entire code is to check out the site.

    http://www.starbaseindy.com

    The code I am talking about is on the main index.html page.

    Thanks again everyone,

    Kim

  • #7
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    one solution could be to take out the toggle(); from the onload in the body tag, and add this in between any of your script tags
    Code:
    setTimeout("toggle()",0);

  • #8
    New Coder
    Join Date
    Jul 2002
    Location
    Indianapolis, Indiana
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Aerospace,

    Well, I am not sure if I understood exactly where you were talking about, but I deleted the toggle from the body onLoad and then moved the new option into the <script> tag for the blink javascript. Unfortunately, it is still not blinking.

    I HATE blink commands, but I feel like I have no other choice. Last year's convention had all the info on the site, but people just wouldnt read the site. Hopefully, with the blinking text on the main page, people will click there and read the answers to some of the most commonly asked questions.

    Thanks,

    Kim

  • #9
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    okay you put it in the wrong place, i said the script tags not in the function try this
    Code:
    <script type="text/javascript"><!--
    
    var time_displayed=1500;	//	How long do you want to show the image for before it is hidden again.
    var time_hidden=500;		//	How long do you want to hide the image for before it is shown again.
    
    var n=0
    var proceed="no"
    
    function blink(){
    
    n=(n==1)?0:1;
    
    if(proceed=="yes"){
    document.getElementById("blinking").style.visibility=(n==1)?"hidden":"visible";
    
    if(n==1){setTimeout("blink()", time_hidden);}
    else{setTimeout("blink()", time_displayed);}
    
    }
    
    else{document.getElementById("blinking").style.visibility="visible";}
    
    }
    
    
    function toggle(){
    
    proceed=(proceed=="yes")?"no":"yes";
    
    blink();
    
    }
    setTimeout("toggle()",0);
    //--></script>
    Last edited by _Aerospace_Eng_; 03-17-2005 at 02:55 PM.

  • #10
    New Coder
    Join Date
    Jul 2002
    Location
    Indianapolis, Indiana
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It should be there now. I uploaded it already.

    Kim

  • #11
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    revised the post above^^ and on a site note u could accomplish the same thing with an animated blinking image, so IF javascript is turned off it would still work

  • #12
    New Coder
    Join Date
    Jul 2002
    Location
    Indianapolis, Indiana
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ARGH!!! Could it be my browser? I am using the latest and greatest of IE.

    Kim

  • #13
    New Coder
    Join Date
    Jul 2002
    Location
    Indianapolis, Indiana
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Does anyone have a suggestion as to why this isnt working??

    Kim

  • #14
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    okay didn't catch it before, u had an extra comma in your previous onload, try this, and take out the setTimeout("toggle()",0); that i told you to put in earlier
    Code:
    onLoad="toggle();MM_preloadImages('images/homeOVER.gif','images/guestsOVER.gif','images/committeesOVER.gif','images/hotelOVER.gif','images/propsOVER.gif','images/photosOVER.gif','images/aboutOVER.gif','images/registerOVER.gif','images/dealersOVER.gif','images/charitiesOVER.gif','images/policiesOVER.gif')"

  • #15
    New Coder
    Join Date
    Jul 2002
    Location
    Indianapolis, Indiana
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks areospace.. that fixed it

    Kim


  •  

    Posting Permissions

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