假设一个textarea里面有很多字符,我用鼠标选择了一部分。如何通过js取得
我选择的那一部分字符?
---------------------------------------------------------------
1<textarea name="test"></textarea>
1<input onclick="alert(document.selection.createRange().text)" type="button" value="test"/>
---------------------------------------------------------------
看看:
1<table border="1" onclick="select()" width="100%">
2<tr>
3<td width="25%">123424</td>
4<td id="aa" width="25%">222222 </td>
5</tr>
6</table>
1<script>
2function select()
3{
4bb=aa.document.selection.createRange();
5bb.text ="111111111111111111111111";
6
7}
8</script>