Forum Moderators: open

Message Too Old, No Replies

Why doesn't this code work in IE

but is graciously loved by Firefox and Netscape

         

Argblat

2:55 pm on Feb 25, 2005 (gmt 0)

10+ Year Member



<html>
<head>

<script type="text/javascript" language="JavaScript">

function openPopup(type)
{
var centerX = ((screen.width / 2) - 250); //Half the screen size minus half the size of the popup window
var centerY = ((screen.height / 2) - 150);
var popupWindow = window.open("popup.asp?type=" + type,"test", "width=500, height=300, top="+ centerY +", left="+ centerX +", menubar=no , toolbar=no, scrollbars=no, resizable=no, status=no");
}

</script>

</head>

<body>
<form name="myform">

<span>Person:</span>
<select>
<option>Person 1</option>
<option>Person 2</option>
<option onclick="openPopup('PassedData')">Enter New Person Info</option>
</select>
</form>
<body>

</html>

------------------------------------------------------

thanks,
Mike

Bernard Marx

3:45 pm on Feb 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<html>
<head>
<script type="text/javascript" language="JavaScript">

function openPopup(select)
{
var type = select.options[select.selectedIndex].value;
if(!type)return;
var centerX = ((screen.width / 2) - 250); //Half the screen size minus half the size of the popup window
var centerY = ((screen.height / 2) - 150);
var popupWindow = window.open("popup.asp?type=" + type,"test", "width=500, height=300, top="+ centerY +", left="+ centerX +", menubar=no , toolbar=no, scrollbars=no, resizable=no, status=no");
}

</script>

</head>

<body>
<form name="myform">

<span>Person:</span>
<select onchange="openPopup(this)">
<option>Person 1</option>
<option>Person 2</option>
<option value="PassedData">Enter New Person Info</option>
</select>
</form>
<body>

</html>

Argblat

4:01 pm on Feb 25, 2005 (gmt 0)

10+ Year Member



Thank you for the elegant solution Bernard,

I think that the most important thing was learning that IE does not support onClick for <option> 's in a drop down.

Totaly bummer

-Mike