CodeIgniter, Kohana, Mootools, jQuery and CSS

How to create a Javascript Pop-up

Posted by teejay on April 16, 2009

If you're like me, you've probably seen a lot of pop-ups on the net. Some sites use them for ads and offers.

If you're here, I'll mostly think that you want to know how to create a Javascript Pop-up. It isn't actually difficult. Here's the code.


See? Very easy. However, you should take note that may open an entirely new window especially if you 'preferred' opening a tab for new pages on your Firefox options, not exactly the pop-up I was thinking about.

Here are a few modifications you can add:

 $('a').click(function(){'', 'newwindow', 'height = 200, width = 300');

This modification actually opens a small window (not a new tab in Firefox).

PS. Yes this is jQuery (the selectors at least)

Categories: How To

Tags: javascript, jquery

No Comments

Comments are not allowed