Picnic Website Code Tutorials

JS Accessible Pop-up Window Tutorial

View Demo

Here is the simplest Accessible Pop-up Window code you will find. No really - stop looking right now - your done! If JS is enabled, the link will open up in a new window. If JS is disabled, the link will open up in the same window. If you still want the link to open up in a new window with or without JS, then just add target="_blank" to the very end (e.g. ...return false" target="_blank">). Note however, the target attribute will not validate when using a strict doctype.

<a href="popup.php" onclick="window.open('popup.php','','width=800,height=600');return false">Pop-up</a>
		

Of course, the above code is completely stripped down to the bear minimum. Below are all the optional attributes you can add to spice up your new window.

<a href="popup.php" onclick="window.open('popup.php','name','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=800,height=600');return false">Pop-up</a>
		

Sponsors

Top Donators

Friends of Mine