What is 'click()' in JavaScript
javascript
Solution
Code within inline event handlers is scoped to the element, as if it was in a `with` block.
Therefore, within the `onclick` handler, the name `click` resolves to the element's `click` method.
This can be demonstrated by writing `alert(nodeName)` in the handler
Problem
I was playing around with JavaScript in FireFox, and hit a problem that is illustrated in the following example: ``` <HEAD> <script type="text/javascript"> function click() { alert("click"); } </script> </HEAD> <BODY> <input type="radio" onclick="click()"> </BODY> ``` When I click on the radio button, nothing happens, and no errors (in Firebug) If I change the name of the function to do_click, and change the onclick, then I get the alert. So question is: what is happening? click does not appear to be a reserved word, or an existing symbol