【开源】dhtml.net 仿javascript访问HTML文档(1.1版)
2010-06-26 09:18
281 查看
本版本为dhtml.net 1.1版,如有疑问请发邮件给我(sqzhuyi@gmail.com)
本版本较1.0版更新如下:
1、解决了一些基本BUG
2、为Element添加了GetElementsByTagName,GetElementsByName,GetElementsClass方法
3、添加document和element的搜索功能,支持类似jquery搜索
示例:
string html = @"<p id=p1><span>aaa</span>
<b>bbb</b><textarea><i>af</i></textarea>
<b class='b1'>b1b1b1</b><input type=checkbox /></p>";
Document doc = new Document(html);
ElementCollect els = doc.Search("#p1 b[class=b1]");
Document 成员如下:
属性
方法
Element 成员如下:
属性
方法
源码下载:
http://download.csdn.net/source/2645389
本版本较1.0版更新如下:
1、解决了一些基本BUG
2、为Element添加了GetElementsByTagName,GetElementsByName,GetElementsClass方法
3、添加document和element的搜索功能,支持类似jquery搜索
示例:
string html = @"<p id=p1><span>aaa</span>
<b>bbb</b><textarea><i>af</i></textarea>
<b class='b1'>b1b1b1</b><input type=checkbox /></p>";
Document doc = new Document(html);
ElementCollect els = doc.Search("#p1 b[class=b1]");
Document 成员如下:
属性
public ElementCollect Elements | 获取HTML文档中的所有节点 |
public Element Body | 获取body节点 |
public string Title | 获取文档title字符串 |
public FormCollect Forms | 获取文档中所有form节点 |
public FrameCollect Frames | 获取文档中所有frame节点 |
public ScriptCollect Scripts | 获取文档中所有script元素 |
public ImageCollect Images | 获取文档中所有img元素 |
public ElementCollect GetElementsByTagName(string tag) | 通过tagName获取节点集合 |
public ElementCollect GetElementsByName(string name) | 通过节点name属性获取节点集合 |
public ElementCollect GetElementsByClass(string clas) | 通过节点class属性获取节点集合 |
public Element GetElementById(string id) | 通过节点id获取该节点 |
public ElementCollect Search(string path) | 搜索文档中符合条件的节点,表达式示例:#div1 span a[class="over"] |
属性
public int Index | 当前节点在elements集合中的索引 |
public string Id | 节点ID |
public string Name | 节点name |
public string Class | 节点class |
public string Style | 节点style |
public string TagName | 节点tagName |
public AttributeCollect Attributes | 节点属性集合 |
public string InnerHTML | 节点innerHTML |
public string OuterHTML | 节点outerHTML |
public Element PreviousSibling | 当前节点的上一个兄弟节点 |
public Element NextSibling | 当前节点的下一个兄弟节点 |
public Element PreviousElement | 当前节点所在集合中的上一个节点 |
public Element NextElement | 当前节点所在集合中的下一个节点 |
public Element ParentElement | 当前节点的父节点 |
public ElementCollect ChildElements | 当前节点的子节点集合 |
public ElementCollect GetElementsByTagName(string tag) | 通过tagName获取节点集合 |
public ElementCollect GetElementsByName(string name) | 通过节点name属性获取节点集合 |
public ElementCollect GetElementsByClass(string clas) | 通过节点class属性获取节点集合 |
public ElementCollect Search(string path) | 搜索文档中符合条件的节点,表达式示例:#div1 span a[class="over"] |
http://download.csdn.net/source/2645389
相关文章推荐
- dhtml.net 仿javascript访问HTML文档
- JavaScript- 通常用于操作 HTML 元素\通过指定的 id 来访问 HTML 元素,并改变其内容\写到文档输出
- ASP.NET的SEO: 服务器控件背后——SEO友好的Html和JavaScript (3)
- ASP.NET将Word文档转化为HTML格式的文档
- .net HTMLParser详细使用说明 强大的Filter类 解析HTML文档如此简单
- (转载)JavaScript一些实用技巧(http://it.chinawin.net/softwaredev/article-261f.html)
- ASP.NET的SEO: 服务器控件背后——SEO友好的Html和JavaScript
- 如何: 通过HTML文档对象模型访问文档中的ActiveX控件的属性 .
- ASP.NET中HTML页面的访问验证设置方法
- 在Asp.net中过滤html,javascript,css样式代码
- ASP.NET 后台CS访问前台HTMLSELECT控件的值
- 利用noesis.Javascript开源组件.Net中执行javascript脚本
- ASP.NET AJAX 说明文档->客户端引用->全局命名空间->JavaScript 基础类型扩展->Array 类型扩展
- ASP.NET AJAX 说明文档->客户端引用->全局命名空间->JavaScript 基础类型扩展->Array 类型扩展->clear 函数
- 转载--Javascript访问html页面的控件的方法详细分析
- asp.net中前台javascript与c#函数相互调方法(http://hi.baidu.com/tracyjay/blog/item/fac2063700b0ea45241f14c2.html)
- 1st JavaScript Editor Pro 3.8,强大的JavaScript开发工具(JavaScript IDE),完美支持CSS, HTML, DOM and DHTML开发、校验、调试
- 国内最火的 HTML、CSS、JavaScript 开源项目 Top 榜
- web前端不可错过的开发工具–Adobe Brackets(开源、简洁强大的HTML、CSS和JavaScript集成开发环境)
- .NET平台开源项目速览(4).NET文档生成工具ADB及使用