<input type='text' value="这是一个测试" id="ice"/>
<input type='button' value='部分选中' onclick="selectPart()"/>
<script>
function selectPart()
{
var rng = ice.createTextRange();
rng.moveStart("word", 2);
rng.moveEnd("word", -1);
rng.select();
}
</script>
<input type='button' value='部分选中' onclick="selectPart()"/>
<script>
function selectPart()
{
var rng = ice.createTextRange();
rng.moveStart("word", 2);
rng.moveEnd("word", -1);
rng.select();
}
</script>
I'll test!
又是怎么算的?
以what为相对位置?