You are here: Reference > HTML > tags > ?IMPORT

?IMPORT element

Browser support:
Imports an element behavior into the specified namespace.
With the import processing instruction (PI) you can attach HTA or HTC files to namespaces. These files are useful to create custom elements, with custom functionality.
The import PI has two attributes, the namespace and the implementation attributes.
The namespace attribute specifies the prefix of the namespace into which the behavior should be imported. The referred namespace must be declared previously by the xmlns attribute.
The implementation attribute specifies the URL of a behavior file or the id attribute of an object tag.
For a detailed description, please visit the IMPORT Processing Instruction (MSDN) site.
The import processing instruction does not seem to work. Use the doImport method in JavaScript instead.
Furthermore, element behaviors can be specified by style settings with the behavior property.
If you want to see the HTML tags by categories, please visit this page.
This element cannot have a closing tag.

Example HTML code 1:

This example illustrates the use of the IMPORT processing instruction:
Code
hover.htc
<html xmlns:myNS="http://help.dottoro.com/NS">
<head>
    <?IMPORT namespace="myNS" implementation="hover.htc" >
</head>
<body>
    <myNS:span>Move the mouse over this text (element with behavior)</myNS:span><br />
    <span>Move the mouse over this text (element without behavior)</span>
</body>
</html>
Did you find this example helpful? yes no

Example HTML code 2:

This example is equivalent to the previous one, but it imports the behavior by the doImport method:
Code
hover.htc
<html xmlns:myNS="http://help.dottoro.com/NS">
<head>
    <script type="text/javascript">
        var namespace = document.namespaces("myNS");
        namespace.doImport("hover.htc");
    </script>
</head>
<body>
    <myNS:span>Move the mouse over this text (element with behavior)</myNS:span><br />
    <span>Move the mouse over this text (element without behavior)</span>
</body>
</html>
Did you find this example helpful? yes no

External links:

User Contributed Comments

Post Content

Post Content