Unobtrusive Javascripts are basically scripts that run on your page if the user has Javascript enabled, if not, the script degrades gracefully to still offer functionality so that you dont get any Javascript errors etc.
Instructions
Download popups.js (right click, save link as) and attach it in the header of any page you want to use it on.
Then simply add a class of “popup” to any link you want the script to work on.
Parameters
There are a couple of parameters you can change. Open the script file, right at the top (lines 4 and 5) are the editable bits.
width = the width of the popup that opens
height = the height of the popup that opens
scrollbar = show the scrollbar or not
menubar = show the menu bar or not.
You can add different “classnames” by simply adding more lines underneath (notice I have “popup” and “popup2″ setup)
Disclaimer:
I didn’t code this myself and I can’t remember where I got it from. If you know the author, please let me know and I will acknowledge them.
Update: I got this code from http://mar.anomy.net/entry/2004/02/09/12.17.47/. Thanks to Steve for suggesting I search Google for the first line of code. Can’t believe I didn’t think of that!
October 7th, 2006 at 12:12 am
Re who wrote the code: Google the first line of code (quote it first) and you’ll find a couple of possible sources.
October 7th, 2006 at 8:08 am
Thanks for that Steve, i’ve updated the article. Can’t believe I didn’t think of that!