Latest web development tutorials

XML DOM lookupPrefix () method

Node Object Reference Node objects

Definition and Usage

lookupPrefix () method returns the prefix matches the specified node in the namespace.

grammar

nodeObject.lookupPrefix(URI)

参数 描述
URI 必需。命名空间 URI。


Examples

The following code fragment uses loadXMLDoc () to " books_ns.xml " into xmlDoc, and finds the first <book> element belongs to the namespace URI prefix:

Examples

xmlDoc=loadXMLDoc("books_ns.xml");

x=xmlDoc.getElementsByTagName("book")[0];

document.write(x.lookupPrefix("http://www.w3cschool.cc/children/"));

Output:

c

try it"

Node Object Reference Node objects