表單提交時(shí)自動(dòng)復(fù)制內(nèi)容到剪貼板的js代碼
更新時(shí)間:2007年03月16日 00:00:00 作者:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>交時(shí)自動(dòng)復(fù)制到剪貼板</title>
</head>
<script language="JavaScript">
/*功能:提交時(shí)自動(dòng)復(fù)制到剪貼板 */
function copyText(obj) {
ie = (document.all)? true:false
if (ie){
var rng = document.body.createTextRange();
rng.moveToElementText(obj);
rng.scrollIntoView();
rng.select();
rng.execCommand("Copy");
rng.collapse(false);
}
}
function autocopy() {
if (this.document.formname.isautocopy.checked) {
copyText(this.document.formname.icontent);
}
}
</script>
<body>
<form action="" method="post" name="formname" onsubmit="autocopy();">
<textarea name="icontent" rows="4" cols="50"></textarea><br>
<input name="isautocopy" checked="checked" value="1" type="checkbox" />
提交時(shí)復(fù)制內(nèi)容到剪貼板<br/><input type="submit" value="提交" /> </form>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>交時(shí)自動(dòng)復(fù)制到剪貼板</title>
</head>
<script language="JavaScript">
/*功能:提交時(shí)自動(dòng)復(fù)制到剪貼板 */
function copyText(obj) {
ie = (document.all)? true:false
if (ie){
var rng = document.body.createTextRange();
rng.moveToElementText(obj);
rng.scrollIntoView();
rng.select();
rng.execCommand("Copy");
rng.collapse(false);
}
}
function autocopy() {
if (this.document.formname.isautocopy.checked) {
copyText(this.document.formname.icontent);
}
}
</script>
<body>
<form action="" method="post" name="formname" onsubmit="autocopy();">
<textarea name="icontent" rows="4" cols="50"></textarea><br>
<input name="isautocopy" checked="checked" value="1" type="checkbox" />
提交時(shí)復(fù)制內(nèi)容到剪貼板<br/><input type="submit" value="提交" /> </form>
</body>
</html>
相關(guān)文章
Web開(kāi)發(fā)必知Javascript技巧大全
JavaScript是一個(gè)絕冠全球的編程語(yǔ)言,可用于Web開(kāi)發(fā)、移動(dòng)應(yīng)用開(kāi)發(fā)(PhoneGap、Appcelerator)、服務(wù)器端開(kāi)發(fā)(Node.js和Wakanda)等等,通過(guò)本文給大家介紹Web開(kāi)發(fā)必知Javascript技巧大全,需要的朋友參考下吧2016-02-02javascript中eval和with用法實(shí)例總結(jié)
這篇文章主要介紹了javascript中eval和with用法,結(jié)合實(shí)例形式總結(jié)分析了JavaScript中eval和with的功能、用法與相關(guān)注意事項(xiàng),具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-11-11功能強(qiáng)大的Bootstrap使用手冊(cè)(一)
這篇文章主要為大家詳細(xì)介紹了功能強(qiáng)大的Bootstrap使用手冊(cè),分享了Bootstrap使用步驟和常用用法,感興趣的小伙伴們可以參考一下2016-08-08