PhilBrown PhilBrown - 5 months ago 19
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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download