|
<script type="text/javascript">
function SmartLink(evt, sender, ajaxJs)
{
var ctrlid = sender.id;
var ctrlhref = sender.href;
sender.href='';
var btn = evt.button;
var IE=navigator.appName=='Microsoft Internet Explorer';
if(!IE){ btn ++ ;}
var classic = false;
if((btn < 2) && (!evt.ctrlKey) && (!evt.shiftKey))
{
eval(ajaxJs);
setTimeout("SmartLinkRestaureHref('"+ctrlid+"', '"+ctrlhref+"')",1);
}
else
{
sender.href=ctrlhref;
}
return false;
}
function SmartLinkRestaureHref(cid, url)
{
document.getElementById(cid).href = url;
}
</script>
<!-- [/reusable functions] -->
<script type="text/javascript">
function MyAjaxLink1()
{
// my ajax method
alert('i can make a ajax call here');
}
</script>
<a id="SmartLink1" href="http://www.google.com" onclick="SmartLink(event, this, 'MyAjaxLink1()');">my smart link 1</a>
<ul>
<li>a simple click on the link : javascript call</li>
<li>a simple click on the link without javascript : classic navigate</li>
<li>open the link on the a new tab/ new window : switch to classic navigate</li>
</ul>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.