JS復(fù)制特定內(nèi)容到粘貼板
更新時(shí)間:2008年12月02日 23:14:38 作者:
比較簡單的復(fù)制內(nèi)容到粘貼板的測試代碼
<script language="javascript">
function readTxt()
{
alert(window.clipboardData.getData("text"));
}
function setTxt()
{
var t=document.getElementById("txt");
t.select();
window.clipboardData.setData('text',t.createTextRange().text);
}
</script>
<input name="txt" value="測試">
<input type="button" value="復(fù)制" onclick="setTxt()">
<input type="button" value="讀取" onclick="readTxt()">
function readTxt()
{
alert(window.clipboardData.getData("text"));
}
function setTxt()
{
var t=document.getElementById("txt");
t.select();
window.clipboardData.setData('text',t.createTextRange().text);
}
</script>
<input name="txt" value="測試">
<input type="button" value="復(fù)制" onclick="setTxt()">
<input type="button" value="讀取" onclick="readTxt()">
您可能感興趣的文章:
- js復(fù)制文本到粘貼板(Clipboard.writeText())
- H5 js點(diǎn)擊按鈕復(fù)制文本到粘貼板
- 基于js實(shí)現(xiàn)復(fù)制內(nèi)容到操作系統(tǒng)粘貼板過程解析
- 20行JS代碼實(shí)現(xiàn)粘貼板復(fù)制功能
- JS復(fù)制對應(yīng)id的內(nèi)容到粘貼板(Ctrl+C效果)
- JavaScript實(shí)現(xiàn)復(fù)制內(nèi)容到粘貼板代碼
- js實(shí)現(xiàn)點(diǎn)擊圖片將圖片地址復(fù)制到粘貼板的方法
- js 實(shí)現(xiàn)復(fù)制到粘貼板的功能代碼
- Web js實(shí)現(xiàn)復(fù)制文本到粘貼板
相關(guān)文章
用asp實(shí)現(xiàn)把文件打包成Xml文件包,帶解包的ASP工具附下載
用asp實(shí)現(xiàn)把文件打包成Xml文件包,帶解包的ASP工具附下載...2007-06-06asp(JavaScript)自動(dòng)判斷網(wǎng)頁編碼并轉(zhuǎn)換的代碼
asp轉(zhuǎn)換網(wǎng)頁編碼的代碼,用正則匹配頁面的編碼聲明是gb2312還是別的,然后輸出。2010-06-06隨機(jī)提取Access/SqlServer數(shù)據(jù)庫中的10條記錄的SQL語句
隨機(jī)提取Access/SqlServer數(shù)據(jù)庫中的10條記錄的SQL語句...2006-07-07C語言數(shù)組添加和刪除元素的實(shí)現(xiàn)
這篇文章主要介紹了C語言數(shù)組添加和刪除元素的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2021-02-02