Click to See Complete Forum and Search --> : Two Scripts, Same Page, One Script Fails


yin26
04-07-2004, 03:33 PM
I've got a site nearly ready to launch here: http://www.yale.edu/iefp/safety/mm_index It uses Menu Magic for the menus.

When I try to add this javascript, the menus are no longer active:

<div id="thisDiv" style="position:relative;width:500; height:22;overflow:hidden; margin:0px;">
<div id="spage" style="position:relative; width:500; height:22; background: #EEEEEE; overflow:hidden;text-align : center; vertical-align : middle;color: blue;">News Feed Temporarily Unavailable</div>
<script language="javascript" src="http://www.ds-osac.org/headline.js"></script>
</div>

This is a script calling to another page for new ticker information.

Now, it's not life or death that Menu Magic and the auto-updating news ticker work together, but I'd like to understand the problem if anybody is kind enough to explain it. I've done what research I can on the forum already and tried to look for variables of the same name, but I'm new to javascript and am missing something.

Many thanks in advance,

Yin

Kor
04-08-2004, 04:15 AM
check if there are two onload event handlers, one for each script. If so, move one callee function from one to another.

window.onload = function(){init1();init2()}

yin26
04-08-2004, 07:51 AM
Thank you for the reply. I imagine you are right, though I'm not sure I can do anything about the onLoad handler on the code I pasted above...can I? It makes a call to a separate Website for the bulk of its action, I think.

But since I'm new to Javascript, how would I do what you are suggesting? You've given a sample, which I'm sure folks more proficient than I would understand, but I'm still unclear. Am I in essence renaming one of the onload handlers to window.onload ? It is as easy as simply finding that code and renaming it? I imagine it's not that easy!

Again, thanks for the help.

yin26
04-12-2004, 07:52 AM
Well, in some ways it's preferable not having the news ticker on the page since its loading determines the load of the rest of the page, and sometimes the load time is slow or simply doesn't happen (not good!).

But I'm still curious as to the problem so I can avoid similar problems in the future...anybody?

Thanks,

Yin