一个标签所标记的元素以及内部文本
HtmlElement
00 Remarks
在选择器里:
- ID 和 类 选择器 区分 大小写
- 标签选择器、属性选择器不区分大小写
类选择器和 ID 选择器可能是区分大小写的。这取决于文档的语言。 HTML 和 XHTML 将类和 ID 值定义为区分大小写,所以类和 ID 值的大小写必须与文档中的相应值匹配。
—— W3C
01 Syntax
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| Add | 2 | |
| GetDirectChilds | 1 | 这个函数是应用于判断HtmlElement.getElementsByClassName())或者HtmlElement.getElementsByName())或者HtmlElement.getElementsByTagName()) 函数所返回来的结果,所以不会对InnerPlantText节点产生误判 |
| getElementById | 1 | Get the element with the specified ID |
| getElementsByClassName | 1 | Get all elements with the specified class name |
| getElementsByName | 1 | Get all elements with the specified name |
| getElementsByTagName | 1 | Get all elements in the document with the specified tag name |
| hasAttribute | 1 | |
| GetPlantText | 1 | |
| ToString | 1 | |
| GetAllChildsByNodeName | 1 | |
| GetAllChilds | 1 | |
| GetHtmlText | 1 |
03 Properties
| Name | Overloads | Summary |
|---|---|---|
| TagName | 1 | 标签名 |
| Attributes | 1 | 标签的属性列表 |
| Element | 1 | get attribute value by attribute name |
| id | 1 | 唯一编号是区分大小写的 |
| class | 1 | |
| HtmlElements | 1 | |
| IsPlantText | 1 | |
| name | 1 | |
| OnlyInnerText | 1 | |
| IsEmpty | 1 |
04 Fields
| Name | Overloads | Summary |
|---|---|---|
| elementNodes | 1 | 当前的这个节点下面所拥有的子节点 |
| tagIndex | 1 | 大小写不敏感 |
| classIndex | 1 | 大小写敏感 |
| nameIndex | 1 | 大小写敏感 |
| idIndex | 1 | 大小写敏感 |
05 Members
String, String)add tagged attribute value.
| Name | Type | Description |
|---|---|---|
name | String | the attribute name |
value | String | the attribute value string. |
IEnumerable(Of InnerPlantText))这个函数是应用于判断HtmlElement.getElementsByClassName()或者HtmlElement.getElementsByName()或者HtmlElement.getElementsByTagName() 函数所返回来的结果,所以不会对InnerPlantText节点产生误判
| Name | Type | Description |
|---|---|---|
query | IEnumerable(Of InnerPlantText) | - |
String)Get the element with the specified ID
The getElementById() method returns the element that has the ID attribute with the specified value. This method Is one Of the most common methods In the HTML DOM, And Is used almost every time you want To manipulate, Or Get info from, an element On your document. Returns null If no elements With the specified ID exists. An ID should be unique within a page. However, If more than one element With the specified ID exists, the getElementById() method returns the first element In the source code.
| Name | Type | Description |
|---|---|---|
id | String | Required. The ID attribute's value of the element you want to get |
An Element Object, representing an element with the specified ID. Returns null if no elements with the specified ID exists
String)Get all elements with the specified class name
The getElementsByClassName() method returns a collection of all elements in the document with the specified class name, as an HTMLCollection object. The HTMLCollection Object represents a collection Of nodes. The nodes can be accessed by index numbers. The index starts at 0. Tip: You can use the length Property Of the HTMLCollection Object To determine the number Of elements With a specified Class name, Then you can Loop through all elements And extract the info you want.
| Name | Type | Description |
|---|---|---|
classname | String | Required. The class name of the elements you want to get. To search for multiple class names, separate them with spaces, Like "test demo". |
An HTMLCollection object, representing a collection of elements with the specified class name. The elements in the returned collection are sorted as they appear in the source code.
String)Get all elements with the specified name
The getElementsByName() method returns a collection of all elements in the document with the specified name (the value of the name attribute), as an HTMLCollection object. The HTMLCollection Object represents a collection Of nodes. The nodes can be accessed by index numbers. The index starts at 0. Tip: You can use the length Property Of the HTMLCollection Object To determine the number Of elements With the specified name, Then you can Loop through all elements And extract the info you want. Note: In HTML5, the "name" attribute Is deprecated And has been replaced by the "id" attribute for many elements. Use the document.getElementById() method where it Is appropriate. Also look at the getElementsByClassName() And getElementsByTagName() methods.
| Name | Type | Description |
|---|---|---|
name | String | Required. The name attribute value of the element you want to access/manipulate |
An HTMLCollection object, representing a collection of elements with the specified name. The elements in the returned collection are sorted as they appear in the source code.
String)Get all elements in the document with the specified tag name
The getElementsByTagName() method returns a collection of all elements in the document with the specified tag name, as an HTMLCollection object. The HTMLCollection Object represents a collection Of nodes. The nodes can be accessed by index numbers. The index starts at 0. Tip: The parametervalue "*" returns all elements In the document. Tip: You can use the length Property Of the HTMLCollection Object To determine the number Of elements With the specified tag name, Then you can Loop through all elements And extract the info you want.
| Name | Type | Description |
|---|---|---|
tagname | String | Required. The tagname of the elements you want to get |
An HTMLCollection object, representing a collection of elements with the specified tag name. The elements in the returned collection are sorted as they appear in the source code.
标签名
标签的属性列表
String)get attribute value by attribute name
| Name | Type | Description |
|---|---|---|
name | String | case insensitive |
this property returns nothing if the attribute is not found from the current element node
唯一编号是区分大小写的
multiple class could be assigned to a html node
当前的这个节点下面所拥有的子节点
大小写不敏感
** 大小写敏感
** 大小写敏感
** 大小写敏感
String)String)