1<!DOCTYPE html> 2<html> 3<body> 4This text won't be selected because it isn't editable. 5<span id='target' contenteditable="true">16-char header. This text is initially selected. 16-char footer.</span> 6This text won't be selected because it isn't editable. 7<script> 8 function select() { 9 var text = document.getElementById('target').firstChild; 10 var range = document.createRange(); 11 range.setStart(text, 16); 12 range.setEnd(text, 48); 13 window.getSelection().addRange(range); 14 } 15 window.onload = select; 16</script> 17</body> 18</html> 19 20