全选并复制表单中内容-网站相关-魔数师说
首页 更多分类 网站相关 正文

全选并复制表单中内容

扫码手机浏览

<html> <title>全选并复制表单中内容</title> <head> <style> .highlighttext{ background-color:yellow; font-weight:bold; } </style> </head> ...
<html>
<title>全选并复制表单中内容</title>
<head>
<style>
.highlighttext{
background-color:yellow;
font-weight:bold;
}
</style>

</head>
<form name=test>
<input type="button" value="全选并复制"  onclick="javascript:HighlightAll('test.select1')" ><br>
<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=''",1800)         
}         
}         
//-->         
</script>
</head>
</html>


阅读全文

本文转载自互联网或其他渠道,侵删!