#1
  1. No Profile Picture
    O.(O.O).O Champion
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2001
    Location
    New York, NY, USA
    Posts
    26
    Rep Power
    0

    Is onClick JavaScript or HTML?


    I was just wondering if onClick is considered Javascript or HTML.
    iRants.com says, "WH(:O)MP! Wazoink!"
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2001
    Posts
    765
    Rep Power
    14
    onclick is an HTML event handler; it's JavaScript, but Javascript/JScript and HTML are intertwined so it's not really a matter of which is which. Many of the JS objects which represent HTML elements (and allow them to be programmable) have a property (variable) named onclick, e.g.:

    Link(object).onclick [HTML: <a href="..." onclick="...">]

    ...which can contain a function; when a click event (mousedown + mouseup) is fired by the browser on the object (element), as a result of the user's action, the function is run. The event handler properties allow events to be bound to HTML elements so code can be run in response to user actions.

    http://www.webreference.com/js/tips/000101.html

    http://www.xs4all.nl/~ppk/js/events_early.html
    Last edited by mrrichardfeder; May 15th, 2002 at 02:14 AM.
  4. #3
  5. No Profile Picture
    O.(O.O).O Champion
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2001
    Location
    New York, NY, USA
    Posts
    26
    Rep Power
    0
    So if I disabled Javascript in my browser, onClick would not work?
    iRants.com says, "WH(:O)MP! Wazoink!"
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Location
    Dublin
    Posts
    413
    Rep Power
    14
    No.
  8. #5
  9. superficial
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2002
    Location
    Peterborough, England
    Posts
    188
    Rep Power
    13
    if you disable javascript, 1/3 of the internet probably wont work. event handlers are very common, especially onclick.

    client side form validation usually makes good use of onblur, onchange and the many others.

    forms can have the onsubmit handler, to run validation or a js function when a whole form is submitted.

    so, all in all, theyre pretty important and widely used.

    why would you want to disable javascript anyway? unless you were super paranoid about script viruses..

    matt
    _______________
    Matt

IMN logo majestic logo threadwatch logo seochat tools logo