The scopeName PropertyYou use the scopeName property with XML embedded in an HTML document in the Internet Explorer. Because you can create XML elements with your own tags, it's common to assign them to different namespaces to avoid overlap between XML elements with the same tag name . The scopeName property of an element gives its namespace. You can see the support for this property in Table 5.50. Table 5.50. The scopeName Property
You also can set a namespace for HTML documents as an attribute of the <HTML> element. The default namespace is "HTML" , but here I'm changing that by defining a namespace "NS" , using that namespace in a <P> element, and then reporting the <P> element's namespace like this: (Listing 05-19.html on the web site)<HTML XMLNS:NS='http://www.starpowder.com'> <HEAD> <TITLE>Using the scopeName Property</TITLE> </HEAD> <BODY> <H1>Using the scopeName Property</H1> <NS:P ID="data1">Here is a paragraph.</NS:P> <SCRIPT LANGUAGE="JavaScript"> <!-- document.write("<BR>Scope name of the paragraph: " + document.getElementById("data1").scopeName) // --> </SCRIPT> </BODY> </HTML> You can see the results in Figure 5.15. Figure 5.15. Using the scopeName property.
|