View Full Version : onload problem

10-16-2006, 09:40 PM
Hey all,

Ive got this problem, Ive added this function which reloads a frameset on the form (onload part).
<body onload="top.frames[0].location.reload()">

but this results in all other buttons not to work?? and i cannot navigate away from the page.???

if i take the onload function out all buttons work?? any ideas on how i can solve this plz?


10-17-2006, 08:58 AM
Confusing.... Can you make it more precise, please? Which other buttons? What other buttons do? Navigate away from which page?

10-17-2006, 09:58 AM
I have a form which has three frames one of them is header, main and footer. The header only loads once thus i cant do anything to it like disable it based on a action on a page....so i found this code below that onload <body onload="top.frames[0].location.reload()"> this reloads the first frame the header which is correct and i can disable the toolbar based on certain action..but the other buttons are
Next to move away from the page, exit and Save jus dont work anymore...:S

10-18-2006, 04:49 PM
I have a problem that has a similar effect. Basically I have javascript menu script that is supposed to load when the page loads and I have another script, basically a news ticker, that also is supposed to load when the page loads.

It seems that if I have both trying to load when the page loads, only the first one that actually loads runs while the other one does not. I'm not sure but it seems that you can't have more than one thing that loads on page load.

Anyone know a way around this?

10-18-2006, 04:53 PM
if boths codes invoke the window.onload (or simply onload) event to start some functions, you must "unify" somehow the onload


and make sure that there is no other window.onload or <body onload="something()"> in your page

see also:

10-18-2006, 05:10 PM
Ive only got one onload function Kor....do u understand my problem??...ive put that code which reloads the toolbar in my body tag but when i click my Next or cancel buttons all it seems to do is reload the page again???

any ideas how i can solve this.

10-18-2006, 05:39 PM
What Kor is saying is... a lot of these copy & paste scripts that you download off the Internet do a lot of behind-the-scenes work. In Paithar's case, the script for his news ticker 'could' invoke code such as: window.onload = initTicker;

Now, it sounds like you might be using some form of menu system? If you coded the menu from scratch yourself then you're obviously familiar enough with the code to know if it runs any such window.onload = ... functions. But if you got it off the Internet, then all Kor is saying is that it's worth taking a closer look at the core of that code.

Scripts interfere with eachother a lot. Be it using the same variable names, or overwriting the same function calls. What you described has the classic symptoms of two scripts conflicting with one-another.

10-18-2006, 06:06 PM
ok, im only running one javascript on "onload" its a problem that when i click next button it reloads the page and does not of the next functions...if i try to put a breakpoint on the next_click it doenst even reach it...when clicked it goes to Page_load and reloads the page because of the onload function in aspx page in body tag....i have no other javascripts.