Information Computer

Friday, August 5, 2011

JavaScript PopUp Window

sometimes if we create a web we will need something called a popup window. popup window is used to bring up a web page in a new window whose size can be set. we can make a popup using javascript. The following source code to create a popup window with javascript.

Create a file with the name index.php

<html>
<head>
<title>PopUp Window</title>
<script>
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page"+id+"=window.open(URL,'"+id+"', 'toolbar=0, scrollbars=0, location=0, statusbar=0, menubar=0, resizable=0, width=250, height=250, left =304,top = 150.5');");
}
</script>
</head>
<body>
<a href="javascript:popUp('popup.html')">popup</a>
</body>
</html>

nb : for green text should be in a row (do not use the enter key).

then make more of a web page for pages that appear in a popup window with the name popup.html .

<html>
<head>
<title>popup</title>
</head>
<body>
PopUp Window
</body>
</html>

That simple example of using a popup window with javascript. may be useful. thank :)


need to know! 
Pop-up ads or pop-ups are a form of online advertising on the World Wide Web intended to attract web traffic or capture email addresses. Pop-ups are generally new web browser windows to display advertisements. The pop-up window containing an advertisement is usually generated by JavaScript, but can be generated by other means as well.

A variation on the pop-up window is the pop-under advertisement, which opens a new browser window hidden under the active window. Pop-unders do not interrupt the user immediately and are not seen until the covering window is closed, making it more difficult to determine which web site opened them.

Related Posts



7 comments:

T Said Annuhsi said...

thanks bro.. :) that useful

Oemar said...

i'm use too in my blog for chatbox.
but, i don't know same or not script. cause i'm get from another web source.

but nice share :D

Mufi_ed said...

nice tutor sob ....

Admin said...

nice

Naughtyric said...

keren blog nya om, mantap :)

Author said...

nice posting...tapi seandainya mau bikin pop up yang hanya muncul 1 kali saja gimana? karna kalo setiap refresh page muncul lagi, akan sangat mengganggu..trims :)

husnu setiawan said...

@author

di sini popup akan muncul jika link popup di file index.php di klik

mungkin maksud agan popup yang muncul ketika halaman di load/di buka ya??

sebenarnya intinya thu dimana anda meletakan javascript:popUp('popup.html')

Followers