SQL PHP HTML ASP JavaScript articles and free scripts to download
JavaScript Tutorials
Popular Tutorials
Drop down list
Timer function
JavaScript Tutorials
String
Array
Date & Time
Form Validation
Event Handling
Math Functions
JavaScript Forum
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.

 
 

Javascript Popup Code

You can generate custom pop-up windows using client side javascript.

You can click here to see a demo popup window with sample content inside.

Here is the source code for the Pop-up window

<html>
<head>
<title>Javascript Popup</title>
<SCRIPT TYPE='text/javascript'>
<!--
function popup(width,height){
	if(window.innerWidth){
	LeftPosition =(window.innerWidth-width)/2;
	TopPosition =((window.innerHeight-height)/4)-50;
			}
	else{
	LeftPosition =(parseInt(window.screen.width)-	width)/2;
	TopPosition=((parseInt(window.screen.height)-height)/2)-50;
			}
	attr = 'resizable=no,scrollbars=yes,width=' + width + ',height=' +
	height + ',screenX=300,screenY=200,left=' + LeftPosition + ',top=' +
	TopPosition + '';
	popWin=open('', 'new_window', attr);
	popWin.document.write('<head><title>Test Popup</title></head>');
	popWin.document.write('<body><div align=center>');
	popWin.document.write('<b>This is a test popup window</b><br><br>');
  	popWin.document.write('Content goes here<br>');
	popWin.document.write('Content goes here<br>');
	popWin.document.write('Content goes here<br>');
  	popWin.document.write('</div></body></html>');
	}
//-->
</SCRIPT>
</head>
<body>
<a href="javascript:popup(400,200);">Generate popup</a>
</body>
</html>
Further readings
Displaying alert window with message
prompt window for user input
Confirm window for user choice
Opening a child window
Closing child window on click of a button
Refreshing parent window from child window
Passing of data from child window to parent window
Showing a conformation window to user before deleting
Displaying JavaScript pop up window
 
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.

Scripts
PHP
JavaScript