PDA

View Full Version : Two Javascripts, first won't run



user_friendly
10-29-2007, 06:40 PM
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/dynamicindex1/hvmenu/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.

jscheuer1
10-29-2007, 08:38 PM
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):


if(Trigger.onload)Dummy=Trigger.onload;
Trigger.onload=Go;

Replace it with:


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.

user_friendly
10-29-2007, 08:56 PM
Thank you so much, works great!