<HTML>
<body>
<Script>
function handler(){
alert("...");
return false;
}
</Script>
<a href="http://w3.org" onclick="return handler()">the browser will go to w3.org</a>
</body>
/*otherwise we can take event parameter into function
and use event.preventDefault()
when handler's retun value should be used,
on* attribute must specify on* "= return handler()"
otherwise return value is usually ignored*/
</HTML>
<body>
<Script>
function handler(){
alert("...");
return false;
}
</Script>
<a href="http://w3.org" onclick="return handler()">the browser will go to w3.org</a>
</body>
/*otherwise we can take event parameter into function
and use event.preventDefault()
when handler's retun value should be used,
on* attribute must specify on* "= return handler()"
otherwise return value is usually ignored*/
</HTML>
댓글
댓글 쓰기