Syntax: Let’s consider an example where you need to click the button to set a function that will output a message in a

element with id="demo". Radio buttons respond to both onchange and onclick events in JavaScript. onclick 事件会在对象被点击时发生。 请注意, onclick 与 onmousedown 不同。单击事件是在同一元素上发生了鼠标按下事件之后又发生了鼠标放开事件时才发生的。 语法 onclick="SomeJavaScriptCode" , ,