« adodb的类封装Win2000如何IIS »

expand方法

语法:
bSuccess = TextRange . expand ( sUnit )
参数:
sUnit :  必选项。字符串(String)。character | word | sentence | textedit character :  扩展一个字符。
word :  扩展一个词。一个词是以空格或其他空白字符(如:tab)为分隔的一组字符。
sentence :  扩展一个句子。一个句子是以结束标点符号(如:句号)为分隔的一组词。
textedit :  扩展整个封闭区域。


返回值:
bSuccess :  布尔值(Boolean)。false | true false :  区域没有被扩展。
true :  区域扩展成功。


说明:
扩展区域使局部单位能够被完全包含进去。
此方法在非 Microsoft® Win32® 平台上不可用。

<script>
var oTextRange;
function rdl_doExpand(){
with (document.all("oSelect")) var sParam=options[selectedIndex].value;
oTextRange=document.selection.createRange();
oTextRange.expand(sParam);
oTextRange.select();
}
function rdl_doInit(){
var oMessage=document.all("oMessage");
oTextRange=document.body.createTextRange();
oTextRange.moveToElementText(oMessage);
oTextRange.select();
}
window.onload=rdl_doInit;
</script>


<span id=oMessage>我是</span>要被选定的信息。
<br>
<table height=56><tr>
<td><select style="width:100px;" id=oSelect>
<option value="character" selected>character</option>
<option value="word">word</option>
<option value="sentence">sentence</option>
<option value="textedit">textedit</option>
</select></td>
<td><input type=button value=" 扩展 " onclick="rdl_doExpand();"></td>
</tr></table>

原创文章如转载,请注明:转载自悠悠博客 [ http://www.ajaxstu.com/ ]

相关文章:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。