js實現(xiàn)的復制兼容chrome和IE
更新時間:2014年04月03日 15:33:17 作者:
這篇文章主要介紹了js在chrome和IE下分別實現(xiàn)復制,需要的朋友可以參考下
IE js代碼:
<script type="text/javascript">
function copyUrl2()
{
var Url2=document.getElementById("biao1");
Url2.select(); // 選擇對象
document.execCommand("Copy"); // 執(zhí)行瀏覽器復制命令
alert("已復制好,可貼粘。");
}
</script>
<textarea cols="20" rows="10" id="biao1">用戶定義的代碼區(qū)域</textarea>
<input type="button" onClick="copyUrl2()" value="點擊復制代碼" />
chrome JS代碼:
<script src="http://www.weicaiyun.com/assets/js/copy/ZeroClipboard.js"></script>
<script type="text/javascript">
var clip = new ZeroClipboard.Client();
clip.setHandCursor( true );
clip.setText('復制內(nèi)容');
clip.glue('button');
</script>
<input type="button" id="button" value="點擊復制代碼" />
復制代碼 代碼如下:
<script type="text/javascript">
function copyUrl2()
{
var Url2=document.getElementById("biao1");
Url2.select(); // 選擇對象
document.execCommand("Copy"); // 執(zhí)行瀏覽器復制命令
alert("已復制好,可貼粘。");
}
</script>
<textarea cols="20" rows="10" id="biao1">用戶定義的代碼區(qū)域</textarea>
<input type="button" onClick="copyUrl2()" value="點擊復制代碼" />
chrome JS代碼:
復制代碼 代碼如下:
<script src="http://www.weicaiyun.com/assets/js/copy/ZeroClipboard.js"></script>
<script type="text/javascript">
var clip = new ZeroClipboard.Client();
clip.setHandCursor( true );
clip.setText('復制內(nèi)容');
clip.glue('button');
</script>
<input type="button" id="button" value="點擊復制代碼" />
您可能感興趣的文章:
- JavaScript實現(xiàn)一鍵復制文本功能的示例代碼
- Web js實現(xiàn)復制文本到粘貼板
- 使用js實現(xiàn)復制功能
- 使用?JS?復制頁面內(nèi)容的三種方案
- JavaScript實現(xiàn)一鍵復制內(nèi)容剪貼板
- js復制文本到粘貼板(Clipboard.writeText())
- JS實現(xiàn)一鍵復制
- Vue中使用highlight.js實現(xiàn)代碼高亮顯示以及點擊復制
- js實現(xiàn)復制粘貼的兩種方法
- JavaScript+Html5實現(xiàn)按鈕復制文字到剪切板功能(手機網(wǎng)頁兼容)
- JS實現(xiàn)復制內(nèi)容到剪貼板功能兼容所有瀏覽器(推薦)
- js實現(xiàn)點擊復制當前文本到剪貼板功能(兼容所有瀏覽器)
- 簡單實現(xiàn)兼容各大瀏覽器的js復制內(nèi)容到剪切板
- JavaScript 實現(xiàn)完美兼容多瀏覽器的復制功能代碼
- 兼容主流瀏覽器的JS復制內(nèi)容到剪貼板
- 兼容所有瀏覽器的js復制插件Zero使用介紹
- 用js將內(nèi)容復制到剪貼板兼容瀏覽器
- js復制網(wǎng)頁內(nèi)容并兼容各主流瀏覽器的代碼
- JS復制內(nèi)容到剪切板的實例代碼(兼容IE與火狐)
- JS/FLASH實現(xiàn)復制代碼到剪貼板(兼容所有瀏覽器)
- 多瀏覽器兼容性比較好的復制到剪貼板的js代碼
- GWT中復制到剪貼板 js+flash實現(xiàn)復制 兼容性比較好
- 兼容IE與Firefox的js 復制代碼
- JavaScript 復制功能代碼 兼容多瀏覽器
- 至2023年最好用的兼容多瀏覽器的原生js復制函數(shù)copyText
相關(guān)文章
使用iframe window的scroll方法控制iframe頁面滾動
在頁面中如何控制內(nèi)嵌的iframe滾動呢?方法是使用iframe window的scroll方法,大家可以參考下面的示例2014-03-03

