Switch to full style
JavaScript code examples
Post a reply

open/close new window using javascript

Thu Sep 15, 2011 10:40 pm

Here example show you how to open/close a new window
Code:

<html>
<
head>Open popup</head>

<
body>
<
script lanuage="JavaScript" type="text/Javascript">
 // Open new window
 function OpenWindow(){
  // setting a new window paramter
  /*
  
  - url to open 
    address of page to open in the new window.

  - window name 
  window title.
 
 
Control Attributes

 


  -width=number
   window width 

  -height=number
    window height

   -resizable=yes or no
      window is resizable (true /false)

   -scrollbars=yes or no
      enable scroll bars (true/false)

   -toolbar=yes or no
      navigation toolbar (true/false)

   -location=yes or no
      show location text filed (true/false)

   -directories=yes or no
     show extra buttons (true/false)

   -status=yes or no
     show or not the window status bar(true/false)

   -menubar=yes or no
     show menubar or not (true/false)

   -copyhistory=yes or no
    copy the navigation history from base window to new window (true/false)

  
  
  
  */
    popupWindow= window.open("close.html","Pop Up", "toolbar=no,width=400,"+
    "height=200,toolbar=yes,location=yes,directories=yes"+
    ",status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes");
    popupWindow.focus()
 }
</script>

<input type="button"   onclick="javascript:OpenWindow()"  value="open new window" />

</body>

</html>


close.html :
Code:
<FORM>
<
INPUT type="button" value="close" onClick="window.close()">
</
FORM>
 




Post a reply
  Related Posts  to : open/close new window using javascript
 Open in a new window help     -  
 Open a link in a new window?     -  
 Google adwords open in new window     -  
 new window using javascript     -  
 First Visit Pop Up Window javascript code     -  
 Reload a Window With a Button javascript code     -  
 Close a file in php     -  
 Close database connections in php     -  
 HTTP POST msg connection close problem     -  
 Which open-source CMS is the best?     -  

Topic Tags

JavaScript Events