如何使用javascript检索链接的地址 [英] how to retrieve the address of a link with javascript

查看:81
本文介绍了如何使用javascript检索链接的地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi

此脚本在用户右键单击浏览器中的链接并单击自定义项目时调用,它返回外部页面的地址,我想检索用户单击的链接的地址,这是什么脚本?
我该怎么办?






hi

this script called when user right click on a link in browser and click on a custom item and it returns the address of the external page , i want to retrieve the address of link that user clicked , what script do this?
and how can i do this?






<SCRIPT>
alert(external.menuArguments.document.URL);
</SCRIPT>

推荐答案



试试这个可以帮助您

Hi,

Try this it can helps you

<a href="Default3.aspx" id="getidlink" onclick="return getlink()">clickhere</a>



并且javascript包含以下方法



And javascript contains following method

function getlink() {
         alert(document.getElementById("getidlink").href);
         return false;
     }




最好的




All the Best


<a href="myotherlink.html" onclick="myfunc(this);">Link to edit page</a>





function myfunc(_this)
{
var href =


( this ).attr(' href'); 警报(href); }
(this).attr('href'); alert(href); }


这篇关于如何使用javascript检索链接的地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆