Which is the better way of using the image as a link..
<A HREF="javascript:password()">
<IMG SRC="pict1.gif" NAME="pic1" ALT="about us!" BORDER="0" align="left"></A>
or the same thing using onClick in the img tag ??
Which one is advisable?? Are both equally good to use??
There are three common techniques:
awithhref="javascript:whatever()"awithhref="#" onclick="whatever(); return false;"imgwithonclick="whatever()"(1) and (2) will create a dotted focus border around the image when its clicked, sometimes this is undesirable.
(1) and (2) adds a border around the image same color as the links in your document so you may want to set border=0.
(1) and (2) will display the hand pointer upon mouse over.
(3) does not behave anything like a link… no focus border, no link color borderm no hand pointer, nothing displayed in the status bar upon mouseover.
Personally, I’d go for option 3: use an
atag for links that take you somewhere, do not use them as action buttons.