RE: Open explorer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Both the parent and child windows can cross-communicate with each other. The
method you're using in your code - window.opener - looks fine.

Rob. 

-----Original Message-----
From: php-objects@xxxxxxxxxxxxxxx [mailto:php-objects@xxxxxxxxxxxxxxx] On
Behalf Of Brian Etheridge
Sent: 09 March 2007 10:05
To: php-objects@xxxxxxxxxxxxxxx
Subject: RE:  Open explorer

Hi Rob,
It is possible for separate windows to communicate with each other.  In an
app I am currently working on I fire upa window which contains a map image.
When the user clicks on the map I update x/y coordinates in the window
behind.  This is done using the window.opener attribute, as follows:
 
This snippet is in the pop-up window:

 
<script language="javascript" type="text/javascript">  function
setXYForMap(e) {
 
  var form = document.popupForm;
  var elem = document.getElementById('map');
  var x = 0;
  var y = 0;
  if (document.all) {
   x = (e.x - elem.offsetLeft);
   y = (e.y - elem.offsetTop);
  } else {
   x = (e.pageX - elem.offsetLeft);
   y = (e.pageY - elem.offsetTop);
  }
  // Assign these values to the original page.
  window.opener.document.getElementById('x_coord').value = x;
  window.opener.document.getElementById('y_coord').value = y;  } </script>
 
===========================================
This snippet is in the parent window.  I haven't tried this but the popwin
javascript variable should allow me to manipulate the pop-up window:
 
var popwin; // Popup window.
function closeWindow() {
 if (popwin && popwin.open && !popwin.closed) {
  popwin.close();
 }
}
function openWindow(url, width, height, target, offset) {
 
 var displaywidth = width;
 var displayheight = height;
 var offsetWin = (offset)? offset: 0;
 var x = 200 + offsetWin;
 var y = 150 + offsetWin;
 
 var parms = ('height='+displayheight+',width='+displaywidth
   + ',resizable=yes,status=no,toolbar=no,'
   + 'menubar=no,location=no,scrollbars=yes, '
   + 'screenx=' + x + ', screeny=' + y + ','
   + 'left=' + x + ',top=' + y);
 
 if (target) {
  window.open(url, target, parms);
 }
 else {
  closeWindow();
  popwin=window.open(url, null, parms);
  if (popwin && popwin.open && !popwin.closed) {
   popwin.focus();
  }
 }
}

***********************************************************************************
Any opinions expressed in email are those of the individual and not necessarily those of the company. This email and any files transmitted with it are confidential and solely for the use of the intended recipient 
or entity to who they are addressed. It may contain material protected by attorney-client privilege. If you are not the intended recipient, or a person responsible for delivering to the intended recipient, be advised that you have received this email in error and that any use is strictly prohibited.

Random House Group + 44 (0) 20 7840 8400
http://www.randomhouse.co.uk
http://www.booksattransworld.co.uk 
http://www.kidsatrandomhouse.co.uk
Generic email address - enquiries@xxxxxxxxxxxxxxxxx

Name & Registered Office:
THE RANDOM HOUSE GROUP LIMITED
20 VAUXHALL BRIDGE ROAD
LONDON
SW1V 2SA
Random House Group Ltd is registered in the United Kingdom with company No. 00954009, VAT number 102838980
***********************************************************************************


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux