Forum Moderators: open

Message Too Old, No Replies

javascript conflict

i need help

         

cdavies

10:53 am on Jun 17, 2004 (gmt 0)

10+ Year Member



hello folks,
I have been asked to develop a site for a local charity, (free of charge of course) and they have asked for multiple menus in different colours. I have a program that creates the menus and it works fine. The problem I have is as soon as I enter the link for the 3rd menu it all falls over. This I think this is due to a javascript conflict. I an using multiple statements as follows.

<SCRIPT LANGUAGE="javascript" SRC="creationmenuone.js"></SCRIPT>

How can I insert 6 or more javascript calls without the conflict? I have looked at the <body onload> attribute but I dont know how to call the above script using the <body onload> method. Any help would be greatfully received.
thanks
chris

Bernard Marx

11:22 am on Jun 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello, c. Your conflict is most likely to come from a conflict over event handlers, and of those, onload - either in the <body>, or scripted - is the most likely of those. But it's not a matter of "calling a script" but "calling a function within a script". We will definately need to know what's in the script to be able to help.

Scan through all the code and look for

[blue]onload[/blue]
. If there's one on the body tag, what function does it call? Look through the script(s) for things like

window.onload = ...

Are there any?

To call 2 functions onload, the simplest way is:

<body onload="function1();function2();">

Rambo Tribble

1:33 pm on Jun 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Chris,

I'm not sure what you mean by calling the script through the onload event. You can call a function within the script file, assuming it was loaded in the head of the document. You cannot, however, load the script file, except through its inclusion in the head at the outset.

cdavies

8:43 pm on Jun 17, 2004 (gmt 0)

10+ Year Member



hello folks, tis me again,
thanks for the replies so far, let me make things a little more clear.
I am using a DHTML menu making program (should I say the program name?) to create the menus. The program saves the generated javascript as an external .js file. I call the file in the following manner:

<SCRIPT LANGUAGE="javascript" SRC="creationmenuone.js"></SCRIPT>
having six menu types, using different colours. What I need to know is how do I call all of them and eliminate the javascript conflict. AS before, any help gratefully received.
best regards
Chris