Log in

View Full Version : javascript called with CSS



djr33
08-06-2006, 10:30 PM
I was thinking about gmail, and then about my own forum. What if I could program all links to give an alert when you were leaving a message that hadn't been saved/posted.

So... I was thinking... sure... add an onclick, with a confirm, and return false. But then.... perhaps it could be done in CSS.

Is there some way to do that? Set every link to a particular javascript function with onclick. Or perhaps onmouseover for images.

Just thinking... there isn't a specific page I'm trying to fix or anything, but I'm sure it could come in handy.

Twey
08-06-2006, 11:20 PM
Not in CSS.
You can loop through elements with a given classname and add the handler(s) in Javascript, though.