popup window problem in onmouseout

Posted by Klbaiju under JavaScript on 3/21/2010 | Views : 5543 | Status : [Member] | Replies : 2
Hi,
i want to open a popup window using javascript.
following is the code
<a href="javascript:;" onmouseout = "window.close('PopUp.aspx');", onmouseover="window.open('PopUp.aspx?textbox=txtStartDate','cal','menubar=no;,location=no;,toolbar=no;,status=no,scrollbars=no,titlebar=no,resizable=no,dependent=no,directories=no,screenX=200,screenY=200,minimize=false,width=200,height=200,left=150,top=180')">

onmouseover is working fine.
but onmoseout is not working and showing an error as an alert box is appearing and ask to close all window.
how it is possible.

Regards
K L BAIJU




Responses

Posted by: Lakhangarg on: 3/22/2010 [Member] [Moderator] Silver

Up
0
Down
Hi Baiju-

Check out this cpiece of code:

<html>

<head>
<title>First Page</title>
<script type="text/javascript" language="javascript">
var NewWind;
function openPopUp()
{
NewWind = window.open('2.html', 'cal', 'menubar=no;');
NewWind.focus();
}
function closePopUp()
{
if (NewWind)
NewWind.close();
}
</script>
</head>
<body>
<a href="#" onmouseout = "closePopUp();",
onmouseover="openPopUp();"> Test Link </a>
</body>
</html>



You need to create the object to keep the track of open window and then you can close that window with that instance.

Thanks
Lakhan Pal Garg

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sagarp on: 3/24/2010 [Member] Bronze

Up
0
Down
<HTML>

<head>
</head>
<BODY>
<a onmouseover="openPopUp()" onmouseout="closePopUp()">
Mouse over to open the popup, mouse out to close it
</a>
</BODY>
</HTML>
<SCRIPT language="javascript">
var popUpWin;
function openPopUp(){
popUpWin = open("", "", "height=50, width=100, top=400, left=400");
popUpWin.document.open();
popUpWin.document.write("Hi, this is a popup!");
}
function closePopUp(){
popUpWin.close();
}
</SCRIPT>


Thanks
SagarP
http://www.emanonsolutions.net
http://emanonsolutions.blogspot.com/

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response