Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: To avoid openning of multiple windows


Message #1 by "Arun" <arun@l...> on Wed, 6 Feb 2002 16:21:09 +0530
Hi

You might "convert" the var "popupWin" into a "global" variable.
You can do this by moving the var outside the function, and
then check if the popupWin allready is an object (that is it is open).
If it is open  then replace the URL of the window's document
instead of opening a new window with window.open():

var popupWin        = '';
function EnterDetails($btnname) {

if (typeof popupWin != 'object') {
     // the window is not created
       popupWin 
window.open("newproject.php?name="+document.frmJob.cbbxName.value+"&project

"+document.frmJob.cbbxProject.value+"&phase="
+document.frmJob.cbbxPhase.valu
e+"&type="+'project',"Addnew",sFeatures);
} else {
     // the window does exist, lets change the URL
popupWin.document.location    = "newproject.php?name="
+document.frmJob.cbbxName.value+"&project
"+document.frmJob.cbbxProject.value+"&phase="
+document.frmJob.cbbxPhase.valu
e+"&type="+'project'
}

That's it! (I hope!) :-)
Have a nice week-end!


Sten Hougaard
EDB Gruppen
Application developer/web-designer



  Return to Index