The scopeName Property


The scopeName Property

You 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

Property

NS2

NS3

NS4

NS6

IE3a

IE3b

IE4

IE5

IE5.5

IE6

scopeName

             

x

x

x

 

Read-only

 

Type: String

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.

graphics/05fig15.gif



Inside Javascript
Inside JavaScript
ISBN: 0735712859
EAN: 2147483647
Year: 2005
Pages: 492
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net