?? domrangeexample4.htm
字號(hào):
<html>
<head>
<title>DOM Range Example</title>
<script type="text/javascript">
function deleteContent() {
var oP1 = document.getElementById("p1");
var oHello = oP1.firstChild.firstChild;
var oWorld = oP1.lastChild;
var oRange = document.createRange();
oRange.setStart(oHello, 2);
oRange.setEnd(oWorld, 3);
oRange.deleteContents();
}
</script>
</head>
<body><p id="p1"><b>Hello</b> World</p>
<input type="button" value="Delete Content" onclick="deleteContent()" />
<p><strong>Note:</strong> This example uses DOM ranges and will only work in browsers that support DOM ranges. This example will fail in Internet Explorer.</p>
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -