mirror of
https://github.com/webodf/WebODF.git
synced 2026-11-30 16:47:58 +01:00
28 lines
983 B
HTML
28 lines
983 B
HTML
<html>
|
|
<head><title></title>
|
|
<script>
|
|
window.onload = function () {
|
|
var selection = window.getSelection(),
|
|
p = document.createElement("p"),
|
|
textnode = document.createTextNode("hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello "),
|
|
range;
|
|
|
|
document.body.appendChild(p);
|
|
p.appendChild(textnode);
|
|
selection.removeAllRanges();
|
|
range = document.createRange();
|
|
range.setStart(textnode, 1);
|
|
selection.removeAllRanges();
|
|
selection.addRange(range);
|
|
|
|
selection.modify("move", "forward", "line");
|
|
|
|
alert(selection.rangeCount + " " + selection.getRangeAt(0).startOffset);
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
</body>
|
|
</html>
|
|
|