ierangeexample4.htm

来自「平时用来学习和编程使用的」· HTM 代码 · 共 22 行

HTM
22
字号
<html>
    <head>
        <title>IE Range Example</title>
        <script type="text/javascript">
            //This example shows what happens when you try to use
            //pasteHTML() while HTML code is selected.
            function useRanges() {
                var oRange = document.body.createTextRange();
                var oP1 = document.getElementById("p1");
                oRange.moveToElementText(oP1);
                oRange.pasteHTML("<p><em>Howdy</em> World</p>");
                alert(document.body.innerHTML);
            }
        </script>
    </head>
    <body><p id="p1"><b>Hello</b> World</p>
        <input type="button" value="Use Ranges" onclick="useRanges()" />      
        <p><strong>Note:</strong> This example uses Internet Explorer ranges and will only work on Internet Explorer.</p>
  
    </body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?