Web EndMemo

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 void to assign value:
<a href="javascript:void(x=5);alert(x);">JS Link</a>
Link

void(0) to avoid page loading:
<a href="javascript:void(0)" 
	ondblclick="alert('dblclick')">Link</a>
Link

Without void(0), page reloaded by a click:
<a href="" ondblclick="alert('dblclick')">Link</a>
Link

void(0) provides a null value for href, thus avoids the unnecessary page loading.