<a href="http://www.xyz.com/file.asp?id=1234" target="_blank" onclick="window.clipboardData.setData('Text',this.innerText)">ID[1234]ID_00.asp</a><br>

解决方案 »

  1.   

    功能一样,但这个有点长
    <script language="javascript"> 
    function copytburl(obj){
    var rng = document.body.createTextRange();
    rng.moveToElementText(obj);
    rng.scrollIntoView();
    rng.select();
    rng.execCommand("Copy");
    rng.collapse(false);
    alert('该地址已经复制到剪切板');
    }
    function sax_getbyid(id) {
    itm = null;
    if (document.getElementById) {
    itm = document.getElementById(id);
    } else if (document.all) {
    itm = document.all[id];
    } else if (document.layers) {
    itm = document.layers[id];
    }
    return itm;
    }
    </script> 
    <a href="http://www.baidu.com?id=196" onclick="copytburl(sax_getbyid('url1'))">
    <span id="url1">ID[1234]ID_00.asp</span></a>