PUBLIC:METHOD Element

Internet Development Index

Defines a method of the HTML Component (HTC) to be exposed to the containing document.

Syntax

<PUBLIC:METHOD
    ID = "sID"
    INTERNALNAME = "sInternalName"
    NAME = "sName"
/>

Attributes

ID
Optional. String that uniquely identifies the PUBLIC:METHOD element within the component. This attribute is analogous to the ID attribute in Dynamic HTML (DHTML).
INTERNALNAME
Optional. String that specifies the name by which the method is referred to within the component. If no value is specified, the NAME attribute is used by default.
NAME
Required. String that specifies the name by which the method is referred to in the containing document. By default, the NAME specified is also used to refer to the method within the component, unless an INTERNALNAME attribute is specified.

Element Information

Parent elementsPUBLIC:COMPONENT
Child elements None
Minimum availabilityInternet Explorer 5
Minimum operating systems Windows 95, Windows NT 4.0

Remarks

By specifying a NAME attribute similar to a standard method name already defined for the element, a behavior can override the element's default behavior.

Examples

This example uses the PUBLIC:METHOD tag to expose the startFlying method from the HTC to the containing document.

<PUBLIC:COMPONENT NAME="toFly">
<PUBLIC:METHOD NAME="startFlying" />
<SCRIPT LANGUAGE="JScript" >
function startFlying()
{
// Insert flying code here
}
</SCRIPT>
</PUBLIC:COMPONENT>

This example of a containing document demonstrates one way to call the method.

<HTML>
<HEAD>
<STYLE>
.FLY   {behavior:url(fly.htc)}
</STYLE>
</HEAD>
<BODY ID="flyingHigh" class="FLY">
<DIV onclick="flyingHigh.startFlying()">
<!-- Insert stuff to fly -->
</DIV>
</BODY>
</HTML>

See Also

Introduction to DHTML Behaviors, Using HTML Components to Implement DHTML Behaviors in Script, PUBLIC:EVENT, PUBLIC:PROPERTY