spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column64


HTML Components

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

Custom Tags and Namespaces

HTCs are based on custom tags which were first introduced in IE 5.0. They allow Web authors to introduce structure to a document while associating style with that structure. For example, you can define a new tag, <RIGHT>, which right-justifies a paragraph:

<HTML XMLNS:DOCJS>
<HEAD>
<STYLE>
@media all {
  DOCJS\:RIGHT {text-align:right; width:100}
}
</STYLE>
</HEAD>
<BODY>
<DOCJS:RIGHT>
 Read Doc JavaScript's columns, tips, tools, and tutorials
</DOCJS:RIGHT>
</BODY>
</HTML>

Internet Explorer's support for custom tags on an HTML page requires that a namespace be defined for the tag. Custom tags definition is based on XML syntax and the namespace is an XML namespace. As shown above, the namespace we use is DOCJS:

<HTML XMLNS:DOCJS>

XMLNS stands for XML NameSpace. We defined a custom tag called RIGHT. Every use of this tag should be prefixed by the appropriate XML namespace, to create the new tag DOCJS:RIGHT. If namespaces are not defined, the custom tag is treated as an unknown tag when the document is parsed. Although navigating to a page with an unknown tag does not result in an error, the new custom tag is not able to contain other tags, nor can behaviors be applied to it. It is also possible to define multiple namespaces on a single HTML tag:

<HTML XMLNS:DOCJS XMLNS:DOCJAVASCRIPT>

Next: How to write the application's top-level page

http://www.internet.com

Produced by Yehuda Shiran and Tomer Shiran

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business


Created: July 3, 2000
Revised: July 3, 2000

URL: http://www.webreference.com/js/column64/3.html