Este artigo descreve o método do JS para implementar a compatibilidade do Pastehtml com IE, Firefox e Chrome. Compartilhe -o para sua referência, como segue:
<html> <body> <script linguage = "javascript"> function test () {if (document.selection && document.selection.createrange) {var myRange = document.selection.createrange (); var m = myRange.PASTEHTML ('<largura de iframe = 100 altura = 100 src = "http: //localhost/t2.htm"> </frame>'); } else if (window.getSelection) {var seleção = 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> Destaque uma parte deste texto e clique no botão abaixo </p> <input id = "myb" type = "button" value = "clique em mim" onclick = "test ();"> </body> </html>For more information about JavaScript related content, please check out the topics of this site: "Summary of JavaScript switching effects and techniques", "Summary of JavaScript search algorithm skills", "Summary of JavaScript animation effects and techniques", "Summary of JavaScript errors and debugging techniques", "Summary of JavaScript data structures and algorithm skills", "Summary of Javascript Algoritmos e Técnicas de Traversal "e" Resumo do Uso do Javascript Mathematic Operations "
Espero que este artigo seja útil para a programação JavaScript de todos.