Issue
How to call javascript from a href?
like:
<a href="<script type='text/javascript'>script code</script>/">Call JavaScript</a>
Solution
<a onClick="yourFunction(); return false;" href="fallback.html">One Way</a>
** Edit **
From the flurry of comments, I'm sharing the resources given/found.
Previous SO Q and A's:
- Do you ever need to specify 'javascript:' in an onclick? (and the IE related A's following)
- javascript function in href vs onclick
Interesting reads:
- http://crisp.tweakblogs.net/blog/the-useless-javascript-pseudo-protocol.html (archive)
- https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Statements/label
Answered By - Dawson
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.