Opening a pop up window using Javascript

I was in need of a JS function of opening a pop up window. I found a wonderful tutorial about this from Here Here is the Javascript Function for POP UP window named popitup()


<script type="text/javascript">// 
function popitup(url) {
       newwindow=window.open(url,'name','scrollbars,height=500,width=500','scrollbars');
       if (window.focus) {newwindow.focus()}
       return false;
}
</script>

The interesting part is, the the window.open() function. The arguments of this function are mainly three. First one is URL, second is NAME. and in third one we can put many characteristics of the popup window. they will have to be in a single quotation mark and distinguished by comma(,) For example, see the above window.open function window.open(url,’name’,’scrollbars,height=500,width=500′). Here after url, name, all other scrollbars, height, width are taken in the single quotation marks.

More functionality can be added in this THIRD part of the argument of window.open() function:

dependent
directories
fullscreen
location
menubar
resizable
scrollbars
status
toolbar
top=200
left=400
width=200
height=200
screenX=400
screenY=200


 <a onclick="return popitup('popupex.html')" href="popupex.html">Link to popup</a>

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s