那里有象createtextrange()函数的说明?

zhangbx 2003-11-20 11:13:46
我看到在文本区选择文本的时候,会用到:
document.form1.textarea1.createtextrange();document.selection.createRange().duplicate();等,从那里能得到这些函数的用法说明?
...全文
143 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
阿米果 2003-11-21
  • 打赏
  • 举报
回复
http://www.rainersu.com/index.asp

去下载一本苏小雨的文档对象模型中文手册预览版

里面有关于DOM对象的大部分方法说明
阿米果 2003-11-21
  • 打赏
  • 举报
回复
<script>
function rdl_doTextRange(){
var oMessage=document.all("oMessage");
var oTextRange=document.body.createTextRange();
if (oTextRange!=null) alert(oTextRange.htmlText);
}
</script>


<span id=oMessage>我是一些文字。</span>
<br><br>
<input type=button value=" 建立选择区" onclick="rdl_doTextRange();">
阿米果 2003-11-21
  • 打赏
  • 举报
回复
createTextRange版本:DHTML Object Model 返回值:有
语法:
oTextRange = object . createTextRange ()
参数:

返回值:
oTextRange : 对象(Element)。如果成功的话返回被建立的 TextRange 对象。

说明:
为 object 建立 TextRange 对象。
使用此 TextRange 对象可以检索和修改 object 内的文本。 TextRange 对象的 htmlText 特性尤其提供了方便。
应用于:
IE4.0+ BODYBUTTONINPUT type=buttonINPUT type=hiddenINPUT type=passwordINPUT type=resetINPUT type=submitINPUT type=textTEXTAREA
kingdomzhf 2003-11-21
  • 打赏
  • 举报
回复
createTextRange Method

--------------------------------------------------------------------------------

Creates a TextRange object for the element.

Syntax

oTextRange = object.createTextRange()
Return Value

Returns a TextRange object if successful, or null otherwise.

Remarks

Use a text range to examine and modify the text within an object.

Examples

This example uses the createTextRange method to create a text range for the document, and then uses the text range to display all the text and HTML tags in the document.

<SCRIPT LANGUAGE="JScript">
var rng = document.body.createTextRange( );
if (rng!=null) {
alert(rng.htmlText);
}
</SCRIPT>
This example uses the createTextRange method to create a text range for the first button element in the document, and then uses the text range to change the text in the button.

<SCRIPT LANGUAGE="JScript">
var coll = document.all.tags("BUTTON");
if (coll!=null && coll.length>0) {
var rng = coll[0].createTextRange();
rng.text = "Clicked";
}
</SCRIPT>
Standards Information

There is no public standard that applies to this method.
bencalie 2003-11-21
  • 打赏
  • 举报
回复
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp
zhangbx 2003-11-21
  • 打赏
  • 举报
回复
这个网站不存在。这些函数属于HTML,还是JAVASCRIPT?
aotianlong 2003-11-20
  • 打赏
  • 举报
回复
http://aotianlong.vicp.net/bookdownload.php?url=download/ebooks/htmlref.chm&id=91

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧