cotton9
asked on
OnClick works, but not OnLoad?
I'm trying to run the following script onLoad instead of onClick, but it does nothing onLoad. The script generates a css popup window onClick by changing the visibility of the div.
How can I get it to run onload?
(I've linked to the script if it helps - 3rd party)
<html>
<head>
<script src="http://www.litotes.demon.co.uk/js_info/scripts/WindowMngr.js" type="text/javascript"></s cript>
</head>
<body>
<a href="#" onclick="return WindowMngr('win16610479'); ">Click Here</a>
<!--Popup Window Code-->
<div id="win16610479">
<h3><a>Title</a></h3>
<div><div><div><p>Text</p> </div></di v></div>
</div>
<!--End Popup Window Code-->
<script>WindowMngr('win166 10479', WindowMngr.CLOSEABLE|Windo wMngr.DRAG ABLE|Windo wMngr.RESI ZEABLE|Win dowMngr.VE RTICAL_SCR OLL);</scr ipt>
</body>
</html>
How can I get it to run onload?
(I've linked to the script if it helps - 3rd party)
<html>
<head>
<script src="http://www.litotes.demon.co.uk/js_info/scripts/WindowMngr.js" type="text/javascript"></s
</head>
<body>
<a href="#" onclick="return WindowMngr('win16610479');
<!--Popup Window Code-->
<div id="win16610479">
<h3><a>Title</a></h3>
<div><div><div><p>Text</p>
</div>
<!--End Popup Window Code-->
<script>WindowMngr('win166
</body>
</html>
Oh wait, on a closer look, you weren't running onload, you were running it inline.
And I think I see where the problem is. Change what I have above to:
<body onload="WindowMngr('win166 10479', WindowMngr.CLOSEABLE|Windo wMngr.DRAG ABLE|Windo wMngr.RESI ZEABLE|Win dowMngr.VE RTICAL_SCR OLL);Windo wMngr('win 16610479') ;">
And I think I see where the problem is. Change what I have above to:
<body onload="WindowMngr('win166
ASKER
Thanks for the help, but that isn't working either. Nothing happened.
The code above is actually fully functional (with onclick) if you want to see the desired effect or test it out.
The code above is actually fully functional (with onclick) if you want to see the desired effect or test it out.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Darn those race conditions!
Thanks for the help ClickCentric
Thanks for the help ClickCentric
Not a problem. Something seemed fishy which caused me to try it out for myself and I knew the coding was right and no errors were getting thrown, so on a hunch I tried the timeout and that did it. You may want to play with the value a bit. It actually works for me with the timeout set to 1 instead of 100, but I have a pretty fast computer. You have to plan for the people who still have the pentium 90's out there. :P
<body>
to
<body onload="WindowMngr('win166
And it didn't work?