document.execCommand("copy"); copy页面中为id 为copy的内容,有属性reaonly = true 但我想要在copy肉容里加上了点东西,如原来内容为test 我想copy出来的 内容为 test ha ha 也就是在内容里再加上 ha ha 4个字母在 调用 document.execCommand("copy"); 命令加上了这几句js :
var code = document.getElementById('code');
//if(!code.readonly) code.readonly =false;
code.vaule=code.value+'ha ha ';
document.getElementById("code").select();
document.execCommand("copy");
但这样没有效果注释去掉,同样没有效果,我还直接把 把id为 copy元素的reaonly = true 去了,都没效果在 IE6.0下要怎么弄才有效
var code = document.getElementById('code');
//if(!code.readonly) code.readonly =false;
code.vaule=code.value+'ha ha ';
document.getElementById("code").select();
document.execCommand("copy");
但这样没有效果注释去掉,同样没有效果,我还直接把 把id为 copy元素的reaonly = true 去了,都没效果在 IE6.0下要怎么弄才有效
<body>
<textarea id="code" name="code" rows="6" cols="100">test </textarea>
<input value="复制" type="button" onClick="copy()">
<script>
function $(id){return document.getElementById(id)}
function copy(){
var y = $('code').innerHTML
$('code').innerHTML=y+'ha ha ';
$('code').select();
document.execCommand('copy');
$('code').innerHTML = y;
}
</script>
</body>