Results 1 to 3 of 3

Thread: Two Javascripts, first won't run

  1. #1
    Join Date
    Oct 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Two Javascripts, first won't run

    1) Script Title:
    <script type='text/javascript' src='DropMenu/exmplmenu_var.js'></script>
    <script type='text/javascript' src='DropMenu/menu_com.js'></script>
    2) Script URL (on DD):
    http://www.dynamicdrive.com/dynamici...menu/index.htm
    address where it is used on our site and not working
    http://www.realestatedurango.com/premium_new.asp
    3) Describe problem:

    This script runs great on all our pages except the one listed about. It is because of a script called below it with the code
    <SCRIPT language=javascript src="http://www.crenidx.com/agent_specific_featured.php?site_id=4770"></SCRIPT>

    I am not familiar with writing javascript and know there has to be an easy solution to getting them both to run. Any help is greatly appreciated.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    There is an onoad conflict. Since I assume you cannot alter the second script, we will have to alter the menu script. Open up menu_com.js in a text only editor like notepad and find this (around line number 46):

    Code:
    	if(Trigger.onload)Dummy=Trigger.onload;
    	Trigger.onload=Go;
    Replace it with:

    Code:
    if ( typeof window.addEventListener != "undefined" )
        window.addEventListener( "load", Go, false );
    else if ( typeof window.attachEvent != "undefined" )
        window.attachEvent( "onload", Go );
    else {
        if ( window.onload != null ) {
            var oldOnload = window.onload;
            window.onload = function ( e ) {
                oldOnload( e );
                Go();
            };
        }
        else
            window.onload = Go;
    }
    Save it and use it instead of the original menu_com.js file. It should work fine for all of your pages.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Oct 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you so much, works great!

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
  •