以下是代码片段:
<html><title>网页特效代码|JsCode.CN|---全选并复制表单中内容</title><head><style>.highlighttext</style>
</head><form name=test><input type="button" value="全选并复制" onclick="javascript:HighlightAll('test.select1')" ><br><textarea name="select1" rows=3 cols=46 >你好,欢迎光临网页特效观止http://www.jscode.cn</textarea></form> <script language="Javascript"> <!-- var copytoclip=1 function HighlightAll(theField) { var tempval=eval("document."+theField) tempval.focus() tempval.select() if (document.all&©toclip==1){ therange=tempval.createTextRange() therange.execCommand("Copy") window.status="Contents highlighted and copied to clipboard!" setTimeout("window.status=''",1800) } } //--> </script></head></html>