View Full Version : Two Scripts Conflicting

01-22-2007, 01:29 AM
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?

01-22-2007, 02:09 AM
window.onload = init;With:
window.onload = function() { init(); contents of onload attribute; };

Alternatively, remove that line and append init(); to the contents of the onload attribute.

01-22-2007, 02:27 AM
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.



01-22-2007, 02:33 AM
the js DID NOT have the window.onload = init; to begin with.It's at the bottom of menu.js.

01-22-2007, 03:47 AM
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...


01-22-2007, 03:57 AM
If it works, why fiddle with it? It is generally considered neater to keep JS out of HTML, but it's no big problem.

01-22-2007, 05:00 AM
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?