Code Snippets

Pop up using Java Script



I will explain  how you can make a pop up box using java script.

 
Script Code


<script>

var newwindow;

function poptastic(url) {

 

 

    newwindow = window.open(url, 'name', "scrollbars=1,resizable=1");

if (window.focus) {newwindow.focus()}

}

</script>

 

 

Insert the above function to the head section of your page .You can pass the url you want to open to this function.here is the code sample

 Sample.html

<html>

<head>

<script>

var newwindow;

function poptastic(url) {

 

 

    newwindow = window.open(url, 'name', "scrollbars=1,resizable=1");

if (window.focus) {newwindow.focus()}

}

</script>

</head>

<body>

 <a href="javascript:poptastic('http://www.shefeekj.com');">Make Pop Up</a>

</body>

</html>

 

 

You can specify the properties of the new window which is opened like scrollbars=1,resizable=1 etc.The other properties

which can be mentioned are

 

status The status bar at the bottom of the window.

toolbar The standard browser toolbar, with buttons such as Back and Forward.

location The Location entry field where you enter the URL.

menubar The menu bar of the window

directories The standard browser directory buttons, such as What’s New and What’s Cool

resizable Allow/Disallow the user to resize the window.

scrollbars Enable the scrollbars if the document is bigger than the window

height Specifies the height of the window in pixels. (example: height=’350′)

width Specifies the width of the window in pixels.

No related posts.

Thanks for reading my blog. If you like what I write, why not subscribe to my feed?

If you are busy, I can send the latest post to your email. Just subscribe to my email updates.

 

Enter your email address:

Delivered by FeedBurner

Discussion

No comments for “Pop up using Java Script”

Post a comment