目录 |
XNJS的函数,用于获得<input>和<textarea>中的文字被选中的位置信息。
|
无参数 |
|
返回值类型 |
描述 |
|
Object |
返回一个对象,该对象有两个属性:start和end,表示选中的文字从位置start到end-1。 |
<input type="text" id="selection_input" size=32/>
<script type="text/javascript">
<!--
var input = document.getElementById('selection_input');
var text_input = input.getValue();
var selection = input.getSelection();
var selected_text = text_input.substring(selection.start, selection.end);
//-->
</script>