<script language= "JScript"> 
var Href=window.location.href;
alert(Href);
</script>
这个是我看的最简单的获取当前url的js代码,但是我不知道如何能把url写到我需要的代码中去,<a href="mailto:?subject=这个网页非常棒,推荐你看看!&body=http://?">发送本页</a>如何写代码能够调用到body=?中,高手快来啊!

解决方案 »

  1.   

    document.write('<a href="mailto:?subject=这个网页非常棒,推荐你看看!&body"+window.location.href+">发送本页</a>')
      

  2.   

    <a href="mailto:?subject=这个网页非常棒,推荐你看看!&body"+window.location.href>发送本页</a>
      

  3.   

    or
    <a href="mailto:?subject=这个网页非常棒,推荐你看看!&body=" onclick="this.href+=window.location.href">发送本页</a& gt;
      

  4.   

    <SCRIPT>
    //获取Url传过来的值
    function Request(name)
    {
         new RegExp("(^|&)"+name+"=([^&]*)").exec(window.location.search.substr(1));
         return RegExp.$2
    }
    thisURL = document.URL;     // http://localhost:81/Test/1.htm?Did=123document.writeln( thisURL ); </SCRIPT><br/><script language= "JScript"> 
    var Href=window.location.href;
    document.writeln( Href ); 
    </script><a href="mailto:?subject=这个网页非常棒,推荐你看看!&body=?">发送本页</a>又找了一种代码,到底如何结合啊,楼上几位写我测试了都不行!
      

  5.   

    <script language="javascript">
    function copyToClipBoard(){
    var clipBoardContent="";
    clipBoardContent+='阎和李: ';
    clipBoardContent+="\n";
    clipBoardContent+=window.location.toString();
    window.clipboardData.setData("Text",clipBoardContent);
    alert("复制成功,请粘贴到QQ/MSN/论坛上让好友吧!");
    }
    </script>
    <input name="Input" onclick='copyToClipBoard()' type="button" class="btn" value="点此复制本页发给QQ/MSN/论坛的好友" />最后我是用这个方法