top left
The HTML Source Logo


 html
Top Right
    
 Getting StartedHow Do I...TroubleShootingPromotionContact Us
 html
HTML
SEARCH THE SITE
advanced search



CATEGORIES
Home
Getting Started
HTML Cheat Sheet
Webmaster Tools
HTML Help Forum
Color Codes
Link to us









































bottom
HTML HTML HTML HTML
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?
How do I make a window Pop-Up automaticlly?


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.

Click Here to see what a pop-up window look's like with all of the option's

Click Here to see what a pop-up window look's like with none of the option's


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.

You can also make the pop-up window automaticlly center itself on the screen, but this involves a little JavaScript, Click Here to go to the JavaScript Section and see how to do it.

And that's it

Back To Top


How do I make a window Pop-Up automaticlly?:  You can also make a window automaticlly open in a set amount of time after the page is open. This is simple to do, you just add a simple JavaScript code to the <head> section of your page, the code look's like this:

<script language="javascript">
timer=setTimeout("window.open('popup.html','','width=200,height=200')",5000)
</script>


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.



Company   |   Careers   |   Partners   |   Advertising   |   Help
Privacy Policy   |   Trademark Notices   |   User Agreement
© 2001 TheHTMlSource.com, INC. All Rights Reserved.



Site hosted by Angelfire.com: Build your free website today!