H
howa
I know some people might argue to use the style like...
document.getElementById("link1").onclick = function () {...
but attach the function into the link directly is more handy and easy
to maintain (i.e. when you delete the link, no codes left behind, and
easy to check what is happening with the link)
anyway, which method you preferred below?
1.
<a href="#" onclick="test()" />
2.
<a href="javascript:test()" />
3.
<a href="javascript:;" onclick="test()" />
4.
<a href="javascript:void(0)" onclick="test()" />
5.
any others?
document.getElementById("link1").onclick = function () {...
but attach the function into the link directly is more handy and easy
to maintain (i.e. when you delete the link, no codes left behind, and
easy to check what is happening with the link)
anyway, which method you preferred below?
1.
<a href="#" onclick="test()" />
2.
<a href="javascript:test()" />
3.
<a href="javascript:;" onclick="test()" />
4.
<a href="javascript:void(0)" onclick="test()" />
5.
any others?