点击文字框自动复制框内文字的代码
七月 16th, 2008
无意中发现个用处不小的网页代码
<script>
function oCopy(obj){
obj.select();
js=obj.createTextRange();
js.execCommand(“Copy”)
}
</script>
<input type=”text” value=”要复制的文字” onclick=”oCopy(this)”>
有些情况要把
<script>
function oCopy(obj){
obj.select();
js=obj.createTextRange();
js.execCommand(“Copy”)
}
</script>
插入到head模块里面