欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JS實(shí)現(xiàn)pasteHTML兼容ie,firefox,chrome的方法

 更新時(shí)間:2016年06月22日 11:00:33   作者:yiluoAK_47  
這篇文章主要介紹了JS實(shí)現(xiàn)pasteHTML兼容ie,firefox,chrome的方法,涉及javascript針對(duì)頁(yè)面元素的動(dòng)態(tài)操作技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了JS實(shí)現(xiàn)pasteHTML兼容ie,firefox,chrome的方法。分享給大家供大家參考,具體如下:

<html>
<body>
<script language="JavaScript">
function test() {
 if (document.selection && document.selection.createRange) {
   var myRange = document.selection.createRange();
   var m = myRange.pasteHTML('<iframe width=100 height=100 src="http://localhost/t2.htm"></iframe>');
 }
 else if (window.getSelection) {
   var selection = window.getSelection();
   var range = window.getSelection().getRangeAt(0);
   range.deleteContents();
   var newP = document.createElement('iframe');
   newP.src="http://localhost/t2.htm";
   newP.width="100";
   newP.height="100";
   range.insertNode(newP);
 }
}
</script>
<p>Highlight a part of this text, then click button below</p>
<input id="myB" type="button" value="Click me" onclick="test();">
</body>
</html>

更多關(guān)于JavaScript相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《JavaScript切換特效與技巧總結(jié)》、《JavaScript查找算法技巧總結(jié)》、《JavaScript動(dòng)畫(huà)特效與技巧匯總》、《JavaScript錯(cuò)誤與調(diào)試技巧總結(jié)》、《JavaScript數(shù)據(jù)結(jié)構(gòu)與算法技巧總結(jié)》、《JavaScript遍歷算法與技巧總結(jié)》及《JavaScript數(shù)學(xué)運(yùn)算用法總結(jié)

希望本文所述對(duì)大家JavaScript程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論