<input type="button" onClick="click()">button text</input>
You should write
<input type="button" value="button text" />
<input type="button">button text</input>
You should rename your function. The function
click() is already defined on a button (it simulates a click), and gets a higher priority then your method.
Note that there are a couple of suggestions here that are plain wrong, and you shouldn't spend to much time on them:
hrefattribute of a hyperlink:
onclick="foo();"both work just fine.
ONCLICKall work. It is common practice to write attributes in lowercase:
document.getElementById("...").onclick = ..., then it must be all lowercase.