OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
| 3 <head> |
| 4 <style> |
| 5 .text { |
| 6 font-family: courier; |
| 7 font-size: 12px; |
| 8 padding: 0px; |
| 9 margin: 0px; |
| 10 border: 0px; |
| 11 } |
| 12 </style> |
| 13 </head> |
3 <body> | 14 <body> |
4 <input id='target' type='text' value='16-char header. ^^ 16-char footer.'></inpu
t> | 15 <textarea id='target' class="text" type='text' rows="3" cols="20"> |
| 16 First Line |
| 17 Second Text Row |
| 18 </textarea> |
5 <script> | 19 <script> |
6 function selectCaret() { | 20 function selectCaret() { |
7 var text = document.getElementById('target'); | 21 var text = document.getElementById('target'); |
8 text.focus(); | 22 text.focus(); |
9 text.setSelectionRange(17, 17); | 23 text.setSelectionRange(17, 17); |
10 } | 24 } |
11 function selectRange() { | 25 function selectRange() { |
12 var text = document.getElementById('target'); | 26 var text = document.getElementById('target'); |
13 text.focus(); | 27 text.focus(); |
14 text.setSelectionRange(16, 18); | 28 text.setSelectionRange(1, 3); |
15 } | 29 } |
16 window.onload = select; | |
17 </script> | 30 </script> |
18 </body> | 31 </body> |
19 </html> | 32 </html> |
20 | 33 |
OLD | NEW |