HTML Cheat Sheet
HTML Help Forum
Link to us
How do I make a Pop-Up Window? There's 2 different types of pop-up windows, the type that pop-up when you click on a link, and the type that pop-up automaticlly. Here's how to create em':|
How do I make a window Pop-Up when a link is clicked?: This is one of the easiest of the 3, simply copy and paste the following code into your web page where you would like the link to appear:
<a href="#" onClick="MyWindow=window.open('http://www.yahoo.com','MyWindow','toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=no,resizable=no,width=600,height=300'); return false;">Click Here</a>
Now before you can use this on your website, your going to have to edit a few things in the code above. Everything that you can edit is written in BOLD text, you shouldn't edit anything else.
1. The first thing your going to need to edit is the address, the code above is set to go to Http://www.yahoo.com, change this to the address of the page you want to pop-up.
2. Next your going to choose the option's you want on the pop-up, you may want to play around with this and see what one's you want, right now the code doesn't have any option's, all of them are set to "no". If you want that option, for example if you want a scrollbar and a toolbar, just replace a "yes" in the box next to that option.
3. The last thing you need to do is edit the "width" and "height". This is another thing your going to want to play around with to see exactly what size you want the window to be.
If you want a Full Screen window to come up you can just simply add a "target=_blank" tag to your normal link code. You use this code if you just want a normal full screen window to open, you can't set the size of the window with this tag. Here's an example:
<a href="the new page.html" target="_blank">
Basiclly all your doing is just telling the browser to target the link into a blank window.
And that's it
Now you're going to need to configure the script a little, first your going to want to change the addres "popup.html" to the address of the window you want to pop-up.
Next chnage the width and height to whatever diminsion's you want the pop-up window to be. You may want to play around with this part to see exactly what size you want the window.
Finally, you're going to need to set how long you want it to take before the window pop's up, right now it's set to 5000 mili second's, witch means 5 seconds. If you want your pop-up window to pop-up in 9 seconds you change the 5000 to 9000.
Hint: the best time for for a pop-up window to come up is right after your page is loaded, most people will just close out a pop-up window if it comes up while the page is still loading, so do some test's, find out how long it takes for your webpage to load, and make the window come up in that set amount of time.
© 2001 TheHTMlSource.com, INC. All Rights Reserved.