Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: SV: SV: Links in Parent window


Message #1 by "Robert Nyman" <robert.nyman@c...> on Fri, 22 Nov 2002 11:35:41 +0100
If you want to keep the confirm thing, just put that code in with the
focus() code...


/Robert


-----Ursprungligt meddelande-----
Fr=E5n: Robert Nyman [mailto:robert.nyman@c...]
Skickat: den 22 november 2002 11:29
Till: javascript
=C4mne: [javascript] SV: Links in Parent window


Here's code for creating a cross-browser modal dialog:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>Custom modal window</title>
=09
<script language=3D"JavaScript" type=3D"text/javascript">
<!--
	var oSmallWin =3D null;
	var bHasBeenOpened =3D false;
	var bNS4 =3D (navigator.appName =3D=3D "Netscape" &&
parseInt(navigator.appVersion, 10) =3D=3D 4)? true : false;
	var bCalledOpenWin =3D false;
	function openWin(oNSEvent){
		if(bHasBeenOpened){
			if(!oSmallWin.closed){
				oSmallWin.focus();
			}
			else{
				oSmallWin =3D
window.open("http://www.google.com", "smallWin",
"left=3D100,top=3D100,width=3D200,height=3D200");
			}		=09
		}=09
		else{
			oSmallWin =3D window.open("http://www.google.com",
"smallWin", "left=3D100,top=3D100,width=3D200,height=3D200");
			bHasBeenOpened =3D true;
		}
	}
	function focusModalWin(oNSEvent){
		if(bHasBeenOpened){
			if(!oSmallWin.closed){
				oSmallWin.focus();
			}
		}
		if(bNS4) document.routeEvent(oNSEvent);
	}
	if(bNS4) document.captureEvents(Event.MOUSEUP);
	document.onmouseup =3D focusModalWin;
//-->
</script>=09
=09
</head>

<body>

<div align=3D"center">
	<a href=3D"#" name=3D"theLink" onMouseUp=3D"openWin(event); return
false" onClick=3D"return false">Open a small window</a> </div>

</body>
</html>


/Robert


-----Ursprungligt meddelande-----
Fr=E5n: arsal01@h... [mailto:arsal01@h...]
Skickat: den 21 november 2002 21:00
Till: javascript
=C4mne: [javascript] Links in Parent window


Hi,

Scenario:
I open a Popup window from main window. When the user tries to remove
the
focus of popup I prompt a confrim dialog if he wants to close the
window.
Incase of "OK" window is closed incase of "Cancel" Popup window is
focused
again.

Problem:
If someone clicks on a link exist on the main window e.g LOGOUT then it
follows the link i.e log u out - i dont want that ---

I want to disable all the links of Parent window till the Popup exist

Thanks
Arsalan




  Return to Index