Results 1 to 7 of 7

Thread: Two Scripts Conflicting

  1. #1
    Join Date
    Jan 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Two Scripts Conflicting

    http://www.smartrealtyinfo.com/css is where the two scripts reside.

    The problem is I have a expanding menu script and a date and time script. I have found out what seems to cause the conflict. If I add to the body tag the "onload" for the date/time the expanding menus script won't work but the date/time does. When I remove the date/time's onload value from the body tag the expanding menus work but the date/time doesn't.

    How can I have both the date/time and the expanding menus script work at the same time?

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Replace:
    Code:
    window.onload = init;
    With:
    Code:
    window.onload = function() { init(); contents of onload attribute; };
    Alternatively, remove that line and append init(); to the contents of the onload attribute.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Jan 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    THANK YOU very VERY very MUCH sir!!!

    I added init(); to the onload in the body tag since the js DID NOT have the window.onload = init; to begin with.

    THANKS!!

    U THE MAN!!!

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    the js DID NOT have the window.onload = init; to begin with.
    It's at the bottom of menu.js.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Jan 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    oh wow I was looking at the date.js.

    anyhow i didn't modify either js file at all. ALL I DID was add "init();" into the body tag.

    it works. but do you think i should do it the other way or keep it the way it is? it doesn't seem like nothing is broken...

    http://www.smartrealtyinfo.com

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    If it works, why fiddle with it? It is generally considered neater to keep JS out of HTML, but it's no big problem.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Jan 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    While I have your attention...in the menu.js the first two variables. I want the menu's to be COLLAPSED when a visitor first visits the site then I want it to remember from link to link.

    var remember = true; //Remember menu states, and restore them on next visit.
    var contractall_default= true; //Should all submenus be contracted by default? (true or false)

    But for some reason it views as EXPANDED when you first visit it unless you set remember to FALSE but then it doesn't remember.

    Can you shine some light on this craziness?

Bookmarks

Posting Permissions

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