To open a popup window we use window.open method in javascript:
Syntax:
window.open(url,"windowname",[windowfeatures]);
URL: Denotes,URL of the page to open in the new window.
windowname: Denotes name of the popup window. The name can be used to refer this window again.
windowfeatures: These contains strings seperated by commas which refers the windows features in off and on mode OR 0 and 1 except some. like width,height
List of windowfeatures :
width: Specifies the width of the window in pixels.
height: Specifies the height of the window in pixels. (example: height='350')
menubar: The menu bar 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.
directories: The standard browser directory buttons, such as What's New and What's Cool
scrollbars: Enable the scrollbars if the document is bigger than the
window
resizable: Allow/Disallow the user to resize the window.
status: The status bar at the bottom of the window.
Example1:
window.open("http://www.computereducationworld.com","computereducation","width=200,height:200");
Example2:
window.open("http://www.computereducationworld.com","computereducation","width=200,height:200,menubar=1,toolbar=1,locationbar=1,resizable=1");
Demo:
Click to Open Popup
-
-
<a href="javascript:void(0);" onclick=‘window.open("use-of-windowopen-method-in-javascript-1373.htm","computereducation","width=600,height=400,menubar=1,toolbar=1,locationbar=1,resizable=1,scrollbars=1");’>Click to Open Popup</a>
-
Post a Comment