共用方式為


IDocument.GetElementById(String) Method

Definition

Returns the Element that has an ID attribute with the given value.

[Android.Runtime.Register("getElementById", "(Ljava/lang/String;)Lorg/w3c/dom/Element;", "GetGetElementById_Ljava_lang_String_Handler:Org.W3c.Dom.IDocumentInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")]
public Org.W3c.Dom.IElement? GetElementById (string? elementId);
[<Android.Runtime.Register("getElementById", "(Ljava/lang/String;)Lorg/w3c/dom/Element;", "GetGetElementById_Ljava_lang_String_Handler:Org.W3c.Dom.IDocumentInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]
abstract member GetElementById : string -> Org.W3c.Dom.IElement

Parameters

elementId
String

The unique id value for an element.

Returns

The matching element or null if there is none.

Attributes

Remarks

Returns the Element that has an ID attribute with the given value. If no such element exists, this returns null . If more than one element has an ID attribute with that value, what is returned is undefined. <br> The DOM implementation is expected to use the attribute Attr.isId to determine if an attribute is of type ID. <p ><b>Note:</b> Attributes with the name "ID" or "id" are not of type ID unless so defined.

Added in DOM Level 2.

Java documentation for org.w3c.dom.Document.getElementById(java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to