Results 1 to 2 of 2

Thread: javascript called with CSS

  1. #1
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default javascript called with CSS

    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.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Not in CSS.
    You can loop through elements with a given classname and add the handler(s) in Javascript, though.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •