<input type="button" name="anniu1" onclick="copyToClipBoard()" value="复制专题地址和url地址,传给QQ/MSN上的好友"> <br><script language="javascript"> <BR>function copyToClipBoard(){ <BR>var clipBoardContent=""; <BR>clipBoardContent+=document.title; <BR>clipBoardContent+=""; <BR>clipBoardContent+=this.location.href; <BR>window.clipboardData.setData("Text",clipBoardContent); <BR>alert("复制成功,请粘贴到你的QQ/MSN上推荐给你的好友"); <BR>} <BR></script> <br><br> <br><br> <br><br><br><span>直接复制url</span><br> <br><input type="button" name="anniu2" onclick="copyUrl()" value="复制URL地址"> <br><script language="javascript"> <BR>function copyUrl() <BR>{ <BR>var clipBoardContent=this.location.href; <BR>window.clipboardData.setData("Text",clipBoardContent); <BR>alert("复制成功!"); <BR>} <BR></script> <br><br><br><span>点击文本框时,复制文本框里面的内容</span><br> <br><input onclick="oCopy(this)" value="你好.要copy的内容!"> <br><script language="javascript"> <BR>function oCopy(obj){ <BR>obj.select(); <BR>js=obj.createTextRange(); <BR>js.execCommand("Copy") <BR>alert("复制成功!"); <BR>} <BR></script> <br><br> <br><br> <br><span>复制文本框或者隐藏域中的内容</span><br> <br><script language="javascript"> <BR>function CopyUrl(target){ <BR>target.value=myimg.value; <BR>target.select(); <BR>js=myimg.createTextRange(); <BR>js.execCommand("Copy"); <BR>alert("复制成功!"); <BR>} <BR>function AddImg(target){ <BR>target.value="[IMG]"+myimg.value+"[/ img]"; <BR>target.select(); <BR>js=target.createTextRange(); <BR>js.execCommand("Copy"); <BR>alert("复制成功!"); <BR>} <BR></script> <br><br><input name="myimg" type="hidden" id="myimg" value="http://www.jb51.net"> <br><input name="imgurl" type="text" size="32" value="http://www.jb51.net"> <br><input type="button" value="点击这里复制本站地址" onclick="CopyUrl(imgurl);"> <br><br><br><br> <br><br> <br><br><span>复制span标记中的内容</span> <br><script type="text/javascript"> <BR></script> <br><br> <br><br> <br><script type="text/javascript">function copyText(obj) <BR>{ <BR>var rng = document.body.createTextRange(); <BR>rng.moveToElementText(obj); <BR>rng.scrollIntoView(); <BR>rng.select(); <BR>rng.execCommand("Copy"); <BR>rng.collapse(false); <BR>alert("复制成功!"); <BR>} <BR></script> <br><br>以下是代码片段:<br> <br><br> <br><span id="tbid">http://www.jb51.net</span> <br>[<a href="#" onclick="copyText(document.getElementById('tbid'))">点击复制</a>] <br><span id="tbid2">http://www.jb51.net</span> <br>[<a href="#" onclick="copyText(document.getElementById('tbid2'))">点击复制</a>] <br>