Why doesn't this work in a browser?

```
<input type="button" id="x">
<a href="javascript:document.getElementById('x').value='something';">Click</a>

```

Yes, I know that I can use onClick to call a function and put my code there, but is there a way to use 'javascript:' with the href attribute to do simple javascript functions like changing a value?