Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Window.Onload doesn't work! Pls Help 1

Status
Not open for further replies.

Forri

Programmer
Oct 29, 2003
479
MT
Hi all

I have the below index.php file. I would like that the window.onload function works but it doesn't!

What is there wrong!?

Thanks
Nick

Code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="">
<link href="library/menu2/CascadeMenu.css" rel="stylesheet">
<link href="library/css/custom.css" rel="stylesheet">


<script type="text/javascript">
window.onload = function() {
alert('first');  
window.showModalDialog('index.php');
}
</script>

<script language="javascript" src="library/function.js"></script>
<script language="javascript" src="library/menu2/CascadeMenu.js"></script>

</head>

<body  onload="InitMenu();" onclick="CloseAll();" bgcolor="#FFFFFF" text="#333333" link="#333333" vlink="#666666" alink="#666666" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"  ID="Bdy">
 
You might be confusing the code. In the JavaScript, you set window.onload, but in the BODY tag, you have an onload event defined to a JavaScript function I do not see. Remove the one you don't want and try again.

'hope that helps.

--Dave
 
Thanks Dave

the Body onload function is part of another script, that's why you cannot see it!

Should i remove it from the body and insert it with the window.onload funciton?


Thanks
Nick
 
try it:
<script type="text/javascript">
window.onload = function() {
alert('first');
window.showModalDialog('index.php');
InitMenu()
}

remove it from the onload function...


Known is handfull, Unknown is worldfull
 
Awesome

Thanks vbkris!!

my mistake!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top