=波波日志 > HTML/WML/CSS兼容/XML > createTextRange Method=
[转]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.
http://msdn.microsoft.com/en-us/library/ms536401(v=VS.85).aspx
类别:HTML/WML/CSS兼容/XML 作者:转载 日期:2010-04-30 【评论:0】
暂时没有评论!
发表留言
百度赞助
同类热门博文
- ·IE对CSS样式表的限制..
- ·HTML 5 WebSocket J..
- ·html5 websocket 通..
- ·Firefox上传文件获取..
- ·javascript获取file..
- ·URL转码方法及不能被..
- ·IE/Firefox/W3C浏览..
- ·CLIP: rect 是什么?
博格Tag
- flash/flex/fcs/AIR(752)
- Asp.Net/C#/WCF(598)
- 操作系统及应用软件(376)
- JavaScript/Ajax(331)
- SQL及数据库(134)
- 黑客技术(115)
- Asp/VBScript(111)
- HTML/WML/CSS兼容/XML(102)
- PHP/apache/Perl(96)
- 网站排名及优化(96)
- 其他(75)
- showbo日志(66)
- lucene.net/分词技术(33)
- 计算机网络(26)
- 机械重工(26)
- C#设计模式(25)
- Google Maps开发(17)
- 日语学习(15)
- Canvas/VML/SVG(13)
- linux(11)
- 游戏开发(8)
- 正则表达式(5)
- Jsp/Java(4)
最新博文
随机博文
