Click to See Complete Forum and Search --> : popup


scragar
07-07-2003, 08:29 AM
I want my page to open a pop-up but I don't know hot to do it, if some-obne was to write the esential's I could fil in the rest.
Here's what a want:
[list=1]
it not to have any resize or menu features
it to load automaticly after my alert.
[/list=1]
I undestand that this is very cheeky but I don't know haw to do it myself and the peple on this site are the smartest kindest people I know of.

pyro
07-07-2003, 08:53 AM
Just place this code after your alerts:

window.open("yourpage.htm","popup","width=400,height=300");And, if you are interested in centering the popup, look at http://www.infinitypages.com/research/centeredpopup.htm

freefall
07-07-2003, 09:04 AM
<script type="text/javascript">
var win = null;
function popupWindow(page,name,w,h,scroll){
leftPos = (screen.width)?(screen.width-w)/2:0;
topPos = (screen.height)?(screen.height-h)/2:0;
settings = "height="+h+",width="+w+",top="+topPos+",left="+leftPos+",scrollbars="+scroll+",resizable";
win = window.open(page,name,settings)
}
</script>

This will center a window in the viewer's window as well. To call this, use a link like so:

<a href="somepage.html" onclick="popupWindow(this.href, 'popup',' 468', '60','no'); return false;">some page</a>

When calling this function, this.href refers to whatever you defined the href as. 'popup' is the name of the window in single quotes, then make sure the dimensions of the window are in single quotes. The last 'no' is for scrolling, you can use 'no' or if you want it to be scrollable, 'auto'. If you're linking to an image file, you should generally add about 20 to the width and height of the window for this script.

Hope this helps,
Ian