HTML A Tag |
HTML A tag specifies a hyperlink. For example, a link to PHP tutorial:
<a href="../php/">PHP Tutorial</a>
PHP Tutorial
A link to PHP tutorial, but open a new window:
<a href="../php/" target=_top>PHP Tutorial</a>
PHP Tutorial in New Window
We can use a hyperlink execute JavaScript, rather than loading a new web page:
<a href="javascript: alert('JS');">JS Link</a>JS Link
Use
<a href="javascript:void(x=5);alert(x);">JS Link</a>Link
<a href="javascript:void(0)" ondblclick="alert('dblclick')">Link</a>Link
Without
<a href="" ondblclick="alert('dblclick')">Link</a>Link