Html程序  |  23行  |  556 B

<!DOCTYPE html>
<html>
<body>
<p>This tests forward deleting 200 characters with 10ms intervals.
The caret shown below should not blink while the characters are being deleted.</p>
<div id="test" contenteditable></div>
<script>

var test = document.getElementById('test');
var text = '';
for (var i = 0; i < 200; i++)
    text += 'a';
test.textContent = text;

test.focus();
getSelection().collapse(test, 0);
for (var i = 0; i < 200; i++)
    setTimeout(function () {document.execCommand('ForwardDelete', false, null);}, i * 10);

</script>
</body>
</html>