Showing posts with label How to use createPopup() Method in JavaScript. Show all posts
Showing posts with label How to use createPopup() Method in JavaScript. Show all posts

Monday, 23 January 2012

How to use createPopup() Method in JavaScript

How to use createPopup() Method in JavaScript
  • The createPopup() method is used to create a pop-up window.
  • Its only support the Internet Explorer
Syntax:
window.createPopup()
Example:
<html>
<body>
<script language="JavaScript">
var pop_window;
function new_window() {
    pop_window = window.createPopup();
    pop_window.document.body.style.backgroundColor = 'red';
    pop_window.show(100,100,100,200,document.body); 
} 
</script>
<input type="button" value="Popup Window" onclick="new_window();">
</body>
</html>
Out Put:
Click on Popup window button.

How to use open() Method in JavaScript
Example:
<html>
<head>
<script type="text/javascript">
function new_window()
{
myWindow=window.open('','','width=200,height=100');
myWindow.document.write("<p>This is new window</p>");
}
</script>
</head>
<body>
<input type="button"  value="Open New Window" onclick="new_window()" />
</body>
</html>
Out Put: