I would like feed back on this FAQ seeing as it is referenced so much here. If anyone has anything to add to it or change on it please let me know and I will make the changes so we can all have a well established FAQ on this topic.
IMPORTANT
follow this link and read the article. this is important to how you have your popup's created in your event. A simple modification to the syntax can make things flow a lot smoother.
This was article was provided for us by xutopia
Thanks
Generating popup windows with JavaScript
Generating popup windows is one of the more simplified functions in JavaScript, but also is one of the most frequently questioned in how to create one.
Basic syntax for a popup window (or simply the creation of a window)
windowHandle = this variable is created to hold the value of the new window
In order to perform functions such as closing.
URL = the target page to open
WindowName = often either given the value of current Time or "," value. This can be used to load separate documents into the page.
Features = there is a wide array of features that can be manipulated in this attribute. The most common are as follows
Width = [specify]
Height = [specify]
For centering your new window use this formula.
var centerWidth=(screen.width/2)-(300/2);
var centerHeight=(screen.height/2)-(300/2);
The only changes needed to be made to this formula is the width (300) and height (300)
The final line would appear like this
"height=300,width=300,top="+centerHeight+",
left="+centerWidth+"";
The following features can all be set to "=0" if they are not wanted to be in the popup window.
toolbar, location, directories, status, scrollbars, menubar, resizable
The following example would be a popup window with a border only as a feature and centered on the users page.
<script>
function openpopup(){
var centerWidth=(screen.width/2)-(300/2);
var centerHeight=(screen.height/2)-(300/2);
winpops=window.open("thanks.htm","","height=300,width=300,top="+centerHeight+",left="+centerWidth+",toolbar=0,location=0,directories=0,
status=0,scrollbars=0,menubar=0,resizable=0,")
}
</script>
<body>
<a href="javascriptpenpopup()">Click here to see popup</a>
</body>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.