<html>
<title>用JS实现文本框内容全选并复制</title>
<head>
<style>
.highlighttext{
background-color:yellow;
font-weight:bold;
}
</style>
</head>
<form name=test>
<input type="button" value="点此全选复制" οnclick="javascript:HighlightAll('test.select1')" >
<textarea name="select1" rows=3 cols=46 >欢迎光临</textarea>
</form>
<script language="Javascript">
<!--
var copytoclip=1
function HighlightAll(theField) {
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
if (document.all && copytoclip==1){
therange=tempval.createTextRange()
therange.execCommand("Copy")
window.status="Contents highlighted and copied to clipboard!"
setTimeout("window.status=''",1780)
}
}
//-->
</script>
</head>
</html>
<title>用JS实现文本框内容全选并复制</title>
<head>
<style>
.highlighttext{
background-color:yellow;
font-weight:bold;
}
</style>
</head>
<form name=test>
<input type="button" value="点此全选复制" οnclick="javascript:HighlightAll('test.select1')" >
<textarea name="select1" rows=3 cols=46 >欢迎光临</textarea>
</form>
<script language="Javascript">
<!--
var copytoclip=1
function HighlightAll(theField) {
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
if (document.all && copytoclip==1){
therange=tempval.createTextRange()
therange.execCommand("Copy")
window.status="Contents highlighted and copied to clipboard!"
setTimeout("window.status=''",1780)
}
}
//-->
</script>
</head>
</html>