PhilBrown PhilBrown - 23 days ago 7
HTML Question

inline javascript in href

How can you do something like this:

<a href="some javascript statement that isn't a function call;" >myLink</a>


And have the js in the href execute when the link is clicked.

Answer Source
<a href="javascript:var hi = 3;" >myLink</a>

Now you can use hi anywhere to get 3.