This example uses Internet Explorer ranges and will only work on Internet Explorer
<html>
<head>
<title>IE Range Example</title>
<script type="text/javascript">
function useRanges() {
var oRange = document.body.createTextRange();
var oP1 = document.getElementById("p1");
oRange.moveToElementText(oP1);
alert(oRange.htmlText);
}
</script>
</head>
<body><p id="p1"><b>Hello</b> World</p>
<input type="button" value="Use Ranges" onclick="useRanges()" />
</body>
</html>
|