[Javascript] Javascript and PHP: Open a new window

Patricia Calatayud patricia.calatayud at itv-denkendorf.de
Mon Nov 25 08:27:53 CST 2002


How can I open a new window from a php/html document and 
get that the terms in the new window are generated dynamically by 
php?

I have used the following, but it doesn´t work.
 
In Normal php document:
<head>
<script><!--
var newWindow = null;
 
function openWindow(contentURL,windowName,windowWidth,windowHeight) {
widthHeight = 'height=' + windowHeight + ',width=' + windowWidth;
newWindow = window.open(contentURL,windowName,widthHeight);
newWindow.focus()
} 
 function closeWindow() {
if (newWindow != null)  {	
   newWindow.close();
  newWindow = null;
 }
 }
 
function toggleWindow(contentURL,windowName,windowWidth,windowHeight)
 {
  if (newWindow == null) {
   widthHeight = 'HEIGHT=' + windowHeight + ',WIDTH=' + windowWidth;
   newWindow = window.open(contentURL,windowName,widthHeight);
   newWindow.focus()
  }
  else {	
      newWindow.close();
      newWindow = null;
  }
 }
 
 // -->
 </script>			
 </head>
 <body onUnload="closeWindow()"> 


<a class="menu2" 
href="javascript:openWindow('newWindow.php','myNewWindow',150,50)">Obe
rbegriffe und Unterbegriffe</a> | 
				<a href="javascript:closeWindow()">Close</a> |
				<a 
href="javascript:toggleWindow('newWindow.php','myNewWindow',150,50)">T
oggle</a>

In new window document:
<head>
<script>
funtion closeWindow() {
self.close();
}
</script>

</head>

<body onLoad="window.moveTo(100,100)" onUnload="opener.newWindow = 
null;">


Is there a good book about PHP, Javascipt and DHTML?
Thanks




More information about the Javascript mailing list