HtmlElementCollection.Item[] 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
컬렉션에서 항목을 가져옵니다.
오버로드
| Name | Description |
|---|---|
| Item[Int32] |
해당 숫자 인덱스 지정하여 컬렉션에서 항목을 가져옵니다. |
| Item[String] |
해당 이름을 지정하여 컬렉션에서 항목을 가져옵니다. |
설명
HtmlElementCollection 개체는 읽기 전용입니다. HTML 문서에 요소를 추가하려면 다음과 같은 InsertAdjacentElement 메서드를 AppendChild사용합니다.
Item[Int32]
- Source:
- HtmlElementCollection.cs
- Source:
- HtmlElementCollection.cs
- Source:
- HtmlElementCollection.cs
- Source:
- HtmlElementCollection.cs
- Source:
- HtmlElementCollection.cs
해당 숫자 인덱스 지정하여 컬렉션에서 항목을 가져옵니다.
public:
property System::Windows::Forms::HtmlElement ^ default[int] { System::Windows::Forms::HtmlElement ^ get(int index); };
public System.Windows.Forms.HtmlElement this[int index] { get; }
public System.Windows.Forms.HtmlElement? this[int index] { get; }
member this.Item(int) : System.Windows.Forms.HtmlElement
Default Public ReadOnly Property Item(index As Integer) As HtmlElement
매개 변수
- index
- Int32
컬렉션에서 항목을 검색할 위치입니다.
속성 값
숫자 인덱스 지정을 통해 컬렉션의 항목입니다.
설명
요소의 HtmlElementCollection 소스 코드 순서가 보장되지 않습니다. 즉, DIV 요소가 태그 내의 첫 번째 요소라고 해서 컬렉션의 BODY 첫 번째 요소가 요소가 되는 DIV 것은 아닙니다.
적용 대상
Item[String]
- Source:
- HtmlElementCollection.cs
- Source:
- HtmlElementCollection.cs
- Source:
- HtmlElementCollection.cs
- Source:
- HtmlElementCollection.cs
- Source:
- HtmlElementCollection.cs
해당 이름을 지정하여 컬렉션에서 항목을 가져옵니다.
public:
property System::Windows::Forms::HtmlElement ^ default[System::String ^] { System::Windows::Forms::HtmlElement ^ get(System::String ^ elementId); };
public System.Windows.Forms.HtmlElement this[string elementId] { get; }
public System.Windows.Forms.HtmlElement? this[string elementId] { get; }
member this.Item(string) : System.Windows.Forms.HtmlElement
Default Public ReadOnly Property Item(elementId As String) As HtmlElement
매개 변수
속성 값
HtmlElement명명된 요소가 있으면 입니다. 그렇지 않으면 null입니다.
예제
다음 코드 예제에서는 해당 이름을 사용 하 여 개체를 찾고 FORM 프로그래밍 방식으로 서버에 해당 데이터를 제출 합니다. 코드 예제에서는 애플리케이션이 명명WebBrowser된 컨트롤을 webBrowser1 호스트해야 합니다.
private void SubmitForm(String formName)
{
HtmlElementCollection elems = null;
HtmlElement elem = null;
if (webBrowser1.Document != null)
{
HtmlDocument doc = webBrowser1.Document;
elems = doc.All.GetElementsByName(formName);
if (elems != null && elems.Count > 0)
{
elem = elems[0];
if (elem.TagName.Equals("FORM"))
{
elem.InvokeMember("Submit");
}
}
}
}
Private Sub SubmitForm(ByVal FormName As String)
Dim Elems As HtmlElementCollection
Dim Elem As HtmlElement
If (WebBrowser1.Document IsNot Nothing) Then
With WebBrowser1.Document
Elems = .All.GetElementsByName(FormName)
If (Not Elems Is Nothing And Elems.Count > 0) Then
Elem = Elems(0)
If (Elem.TagName.Equals("FORM")) Then
Elem.InvokeMember("Submit")
End If
End If
End With
End If
End Sub