Behaviors
This topic documents a feature of Binary Behaviors, which are obsolete as of Internet Explorer 10.
Dynamic HTML (DHTML) behaviors are components that encapsulate specific functionality or behavior on a page. When applied to a standard HTML element on a page, a behavior enhances that element's default behavior. An element behavior enables you to add a custom element to pages. And a ViewLink enables a document tree to be encapsulated in an HTML Component (HTC) file, separate from the content of the main Web page.
Overviews/Tutorials
Web developers are constantly searching for ways to design and implement sites that deliver the best user experience possible. One way to enhance user experience is to customize content based on capabilities that the client browser supports. By making this information available on the client, pages can be cached, server roundtrips minimized, server resources freed up as content generation shifts back to the client, and overall performance improved.
Element behaviors are one of the most significant new capabilities in Microsoft Internet Explorer 5.5. They provide the capability to define custom elements, which can be used in the same way as normal HTML elements in a Web page. An element behavior can be written in script using an HTC file, or it can be implemented with a binary DHTML behavior. Element behaviors are encapsulated components, so they can add new and interesting functionality to a Web page while improving the organization of content, functionality, and style.
The WebService behavior enables client-side script to invoke remote methods exposed by Web Services, or other Web servers, that support the SOAP and Web Services Description Language (WSDL) 1.1. This behavior provides developers the opportunity to use and leverage SOAP, without requiring expert knowledge of its implementation. The WebService behavior supports the use of a wide variety of data types, including intrinsic SOAP data types, arrays, objects, and XML data. The WebService behavior is implemented with an HTC file as an attached behavior, so it can be used in Internet Explorer 5 and later versions.
The Web Folder Behaviors available as of Internet Explorer 5 and later allow users to navigate to a folder view, and include support for Distributed Authoring and Versioning (DAV) and Web Extender Client (WEC) protocols. DAV is a series of extensions to the http and defines how basic file functions, such as copy, move, delete, and create folder, are performed across http. WEC is a Microsoft FrontPage protocol that provides the same sort of functionality as DAV, in addition to its own value-added FrontPage features. Both protocols define how to set and retrieve properties on http resources.
Detectable Components in Internet Explorer
The following table lists the component identifiers that can be detected with Internet Explorer 5.
Installable Components in Internet Explorer
The following table lists the component identifiers that can be installed with Internet Explorer 5. These identifiers are used with the addComponentRequest method.
Introduction to DHTML Behaviors
One of the most exciting new features introduced in Internet Explorer 5.5 is DHTML behaviors. DHTML behaviors are components that encapsulate specific functionality or behavior on a page. When applied to a standard HTML element on a page, a behavior enhances that element's default behavior.
Persistence enables authors to specify an object to persist on the client during the current and later sessions using DHTML behaviors. Persistence allows Internet Explorer 5 and later to retain Web page information, styles, variables, and state.
Persisting Collapsible Table of Contents State
Web pages that employ a collapsible table of contents tend to share a single problem: when a user leaves the page, the table of contents reverts to its original state. For anyone trying to navigate through these nested references, it is frustrating to leave the page and return, only to have to wade through the table of contents again. Persistence behavior provides a solution to this problem.
Persisting Custom and Dynamic Styles
Dynamic and custom styles selected at run time by the user can be persisted when the page is saved as a favorite using the saveFavorite behavior.
Using HTML to design forms comes with some drawbacks, namely the need for a server or client-side script to process the form data. The saveSnapshot behavior can be used to save a Web page and persist the form data directly within the page itself. This allows a larger audience to use Web forms for day-to-day activities without needing a special script to process and deliver the information.
Persisting Session Information
Session information is usually recorded for sites that use multiple pages to accomplish a task, such as virtual shopping carts and advanced search engines. Pages that employ these variables and files can easily swell to a very large size while they juggle delivering a Web page and processing the surrounding scripts. Persistence allows most of this information to be stored on the client, thus decreasing download time and the performance hit to the server's processor(s).
Security Considerations: DHTML and Default Behaviors
This document provides information about security considerations related to DHTML behaviors.
Lists the possible formats for expressing time values.
Using Custom Tags in Internet Explorer
This article discusses the benefits of defining custom tags in a document, as well as the details involved in using them on a page.
Applying a behavior to an element is as easy as attaching a style to an element on a page. This article covers the different approaches and considerations to applying a behavior to standard HTML elements. In addition, it presents some interesting applications of behaviors in Internet Explorer 5 and later. After reading the article, you'll be able to start applying behaviors to your own pages, isolate script from your content, and take advantage of the resulting cleaner pages.
Using HTML Components to Implement DHTML Behaviors in Script
This article outlines the steps for using HTC files to create behaviors in script.
Using the literalContent Attribute
This overview introduces you to the literalContent attribute of the PUBLIC:COMPONENT element and describes some of the ways you can use it to enhance your Web pages. Use the PUBLIC:COMPONENT element when you define an HTC and when you define the primary characteristics of a DHTML behavior. You can implement a DHTML behavior as an attached behavior, which modifies the behavior of an existing element, or as an element behavior, which defines a custom element. Use the literalContent attribute when defining an element behavior to specify whether MSHTML parses the content inside the custom element.
This article explains how to use the WebService behavior to call remote methods from Web Services. The WebService behavior is implemented with an HTC file as an attached behavior, so it can be used in Internet Explorer 5 and later versions. Most of this article focuses on how to use the WebService behavior, but it also touches briefly on Web Services that are used by the WebService behavior. The About the WebService Behavior provides additional discussion and information on the main benefits and features of the WebService behavior; it also provides numerous links to related Web sites.
WebService Behavior: Supported Data Types
This document describes the ASP.NET and XML data types supported by the WebService behavior.
Attributes and Properties
Specifies the mode of remote method invocation.
Obsolete. Retrieves the height of the working area of the system's screen, excluding the Windows taskbar.
Obsolete. Retrieves the width of the working area of the system's screen, excluding the Windows taskbar.
Sets or retrieves whether the ToolTip behavior moves away from the mouse cursor.
Sets or retrieves the container background color of the mpc behavior.
Gets or sets the location of the DHTML behavior.
Deprecated. Retrieves the number of bits per pixel used for colors on the off-screen bitmap buffer.
Specifies the height of buttons within the coolbar behavior.
Specifies the width of buttons within the coolbar behavior.
calCurrentMonthBackgroundColor
Sets or retrieves the background color of the current month for the calendar behavior.
Sets or retrieves the color of the current month for the calendar behavior.
Sets or retrieves the name of the font used for the active month cells in the calendar behavior.
Sets or retrieves the size of the font used for the current month in the calendar behavior.
Sets or retrieves the weight of the font used for the current month in the calendar behavior.
Sets or retrieves whether the text is left-aligned, right-aligned, centered, or justified for the current month in the calendar behavior.
Sets or retrieves the vertical alignment of text in the cells of the current month for the calendar behavior.
Sets or retrieves the background color of the title field where the days of the week are listed for the calendar behavior.
Sets or retrieves the color of the days of the week for the calendar behavior.
Sets or retrieves the name of the font used for the calendar behavior.
Sets or retrieves the size of the font used for the names of the days of the week in the calendar behavior.
Sets or retrieves the weight of the font used for the names of the days of the week in the calendar behavior.
Sets or retrieves whether the text is left-aligned, right-aligned, centered, or justified for the calendar behavior.
Sets or retrieves the background color of the previous and next months for the calendar behavior.
Sets or retrieves the color of the days of the week in the previous and next months for the calendar behavior.
Sets or retrieves the name of the font used in the previous and next month fields for the calendar behavior.
Sets or retrieves the size of the font used for the calendar behavior.
Sets or retrieves the weight of the font used for the previous and next months in the calendar behavior.
Sets or retrieves whether the text is left-aligned, right-aligned, centered, or justified for the calendar behavior.
Sets or retrieves the vertical alignment of text in the cells of the previous and next months for the calendar behavior.
Sets or retrieves the background color of the selected day for the calendar behavior.
Sets or retrieves the color of the selected day for the calendar behavior.
Sets or retrieves the name of the font used for the selected day in the calendar behavior.
Sets or retrieves the size of the font used for the selected day in the calendar behavior.
Sets or retrieves the weight of the font used for the selected day in the calendar behavior.
Sets or retrieves whether the text is left-aligned, right-aligned, centered, or justified for the selected day in the calendar behavior.
Sets or retrieves the vertical alignment of text in the cells of the selected day for the calendar behavior.
Sets or retrieves the title color style for the calendar behavior.
Sets or retrieves the name of the font used for the calendar behavior.
Sets or retrieves the size of the font used for the calendar behavior.
Sets or retrieves the weight of the font used for the calendar behavior.
Sets or retrieves whether the calendar title is left-aligned, right-aligned, centered, or justified for the calendar behavior.
Gets or sets the value indicating whether the object can contain rich HTML markup.
Specifies the rendered border style for the coolbutton behavior.
Specifies the width of the button border for the coolbutton behavior.
Specifies the color of the background to display when the mouse cursor hovers over the coolbutton behavior.
Specifies the border to display when the mouse cursor hovers over the coolbutton behavior.
Specifies the color of the text to display when the mouse cursor hovers over the coolbutton behavior.
Specifies the color of the background to display when the coolbutton behavior is selected.
Specifies the border to display when the coolbutton behavior is selected.
A machine-readable error code that corresponds to a specific invocation of the callService method.
Sets or retrieves the container text color of the mpc behavior.
Deprecated. Retrieves the number of bits per pixel used for colors on the destination device or buffer.
Obsolete. Retrieves the type of connection in use.
Sets or retrieves the string that indicates whether the user can edit the content of the object.
Obsolete. Specifies whether client-side cookies are enabled in the browser.
Sets or retrieves the height of individual colors displayed by the colorpick behavior.
Sets or retrieves the width of individual colors displayed by the colorpick behavior.
Sets or retrieves the height of the colorpick behavior.
Sets or retrieves the number of colors that are displayed by the colorpick behavior.
Sets or retrieves the borderWidth, borderStyle, and borderColor properties to be drawn around the individual colors of the colorpick behavior.
Sets or retrieves the width of the colorpick behavior.
Sets or retrieves the borderWidth, borderStyle, and borderColor properties to be drawn when the mouse cursor hovers over a particular color.
Sets or retrieves the borderWidth, borderStyle, and borderColor properties to be drawn around a selected color in the colorpick behavior.
Obsolete. Retrieves a string representing the CPU class.
Sets or retrieves the name of the field used for the visible text of the dataselect behavior options.
Sets or retrieves the name of the field used for the value of the dataselect behavior options.
Sets or retrieves the source of the data for the dataselect behavior.
Returns the selected day for the calendar behavior.
Sets or retrieves the length of the days for the calendar behavior.
Sets or retrieves the amount of time, in milliseconds, before showing the ToolTip.
Specifies the direction in which an element can be moved for the movable behavior.
Sets or retrieves how long the ToolTip is displayed, in seconds.
Specifies whether the onchange event continually fires while the slider is in motion.
Sets or retrieves the ID attribute of the object that uses the ToolTip behavior.
A property of the call object that specifies an URL that can be used to obtain the WSDL for a Web Service.
A Boolean property created by the WebService behavior after calling the callService method.
Sets or retrieves the expiration date of data persisted with the userData behavior.
Sets or retrieves the day of the week to display in the first column for the calendar behavior.
Sets or retrieves a namespace extension, address, or path.
Specifies the name of a remote function exposed by a Web Service.
Specifies how the grid lines are rendered for the calendar behavior.
Specifies the color of the grid lines for the calendar behavior.
Specifies that the button belongs to a group that acts exclusively for the coolbutton behavior.
Sets or retrieves the container height of the mpc behavior.
Obsolete. Retrieves the vertical resolution of the screen.
Specifies the image source to display when the mouse hovers over the coolbutton behavior.
Specifies the image source to display when the mouse cursor hovers over an object.
A property of the result object that has a unique value which corresponds to a specific execution of the callService method.
Specifies the image source to display for the coolbutton behavior.
Sets or retrieves the Microsoft DirectAnimation Image (DAImage class) displayed by the anim:DA element.
Specifies the source path of the image to display when a menu is expanded for the menu behavior.
Specifies the source path of the image to display when a menu is closed for the menu behavior.
Retrieves the value indicating whether the content of the object contains one or more lines.
Obsolete. Retrieves whether the Microsoft virtual machine (Microsoft VM) is enabled.
Retrieves whether the overall state of the menu is closed or expanded for the menu behavior.
Sets or retrieves the highest value on a continuous range of possible values for the slider behavior.
Sets or retrieves the lowest value on a continuous range of possible values for the slider behavior.
Specifies the current month for the calendar behavior.
Specifies the length of the month names for the calendar behavior.
Specifies whether the element can be moved for the movable behavior.
Sets or retrieves the boundaries that the object can move within based on a composite value of the mv--boundary-left, mv--boundary-top, mv--boundary-right, and mv--boundary-bottom attributes for the movable behavior.
Sets or retrieves the bottom boundary that an object can move within for the movable behavior.
Sets or retrieves the left boundary that an object can move within for the movable behavior.
Sets or retrieves the right boundary that an object can move within for the movable behavior.
Sets or retrieves the top boundary that an object can move within for the movable behavior.
Sets or retrieves the composite values (mv--grid-rows, mv--grid-cols) of the horizontal and vertical grid the element snaps to when the SNAPABLE attribute is enabled for the movable behavior.
Sets or retrieves the distance, in pixels, between columns of the grid that elements snap to when the SNAPABLE attribute is enabled for the movable behavior.
Sets or retrieves the distance, in pixels, between rows of the grid that elements snap to when the SNAPABLE attribute is enabled for the movable behavior.
Sets or retrieves the indentation for each menu level in the menu behavior.
Sets or retrieves the name of the colorpick behavior.
Retrieves the name of the namespace.
A property of the call object that specifies an associative array of parameter values.
Specifies a password for Web Services that require user authentication.
Obsolete. Retrieves the platform on which the browser is running.
Specifies a port name that is used to access resources provided by a Web Service.
Sets or retrieves a preset input mask for the mask behavior.
Specifies the new image source to display when the img object is clicked.
Exposes the raw SOAP data packet returned by the Web Service after invoking the callService method.
Sets or retrieves whether the keyboard and mouse are disabled for the calendar behavior.
Specifies the persistence of the connection information required by Web services that use Secure Sockets Layer (SSL) authentication.
Sets or retrieves the background color displayed when the mouse cursor hovers over a table row for the rowover behavior.
Sets or retrieves the text color for the highlighted table row when using the rowover behavior.
Sets or retrieves the light color for alternately striped table rows when using the rowover behavior.
Sets or retrieves the background color for the selected table row when using the rowover behavior.
Sets or retrieves the text color for the selected table row when using the rowover behavior.
Sets or retrieves the shade color for alternately striped table rows when using the rowover behavior.
Specifies whether the contents of the element can be selected for the movable behavior.
Sets or retrieves whether clicking a table row selects the contents for all cells in the row when using the rowover behavior.
Sets or retrieves the selected tab of the mpc behavior.
Indicates whether the WSDL information was returned successfully from an invocation of the useService method.
Specifies the URL of a Web Service.
Sets or retrieves whether the date selectors should be displayed for the calendar behavior.
Sets or retrieves whether the days of the week should be displayed for the calendar behavior.
Sets or retrieves whether horizontal grid lines are displayed for the calendar behavior.
Sets or retrieves whether the month and year are displayed as a title for the calendar behavior.
Sets or retrieves whether vertical grid lines are displayed for the calendar behavior.
Specifies the width of buttons within the coolbar behavior.
Sets or retrieves the background color of the slider bar.
Sets or retrieves whether the slider bar for the slider behavior will render horizontally or vertically.
Specifies whether the slider is automatically positioned over the nearest tick mark when the mouse button is released.
Sets or retrieves the color of the ticks for the slider behavior.
Sets or retrieves the location of the ticks for the slider behavior.
Specifies whether the element snaps to a grid when the ondragend event fires for the movable behavior.
An Array of SOAP headers that overrides the default SOAP header generated by the WebService behavior.
Sets or retrieves the DirectAnimation sound (DASound class) played by the anim:DA element.
Retrieves whether the button is pressed for the coolbutton behavior.
Retrieves whether the state of a particular menu is closed or expanded for the menu behavior.
Retrieves an object containing the DAStatics class library used with DirectAnimation.
A human-readable error message that corresponds to a specific invocation of the callService method.
Sets or retrieves whether alternate table rows are shaded for the rowover behavior.
Obsolete. Retrieves the default language that the system is running.
Sets or retrieves whether an element behavior can receive focus and participate in the tabbing sequence.
Sets or retrieves the text displayed in the multipage tab of the mpc behavior.
Sets or retrieves the text displayed as a ToolTip in the multipage tab of the mpc behavior.
Sets or retrieves the name of a window or frame that is the target for navigation.
Sets or retrieves the location of the tabs within the container of the mpc behavior.
Sets or retrieves the number of ticks representing one unit of value for the slider behavior.
Sets or retrieves the total number of ticks on the slider behavior.
Not supported.
Sets or retrieves the ToolTip that is displayed when the mouse hovers over the coolbutton behavior.
Obsolete. Retrieves the current user language.
Specifies a user name for Web Services that require user authentication.
Retrieves the sFriendlyName parameter that is passed to the useService method.
Sets or retrieves the current date for the calendar behavior.
Sets or retrieves the value of the colorpick behavior.
Sets or retrieves the initial selected option in the dataselect behavior.
A property of the result object that is created at run time.
Sets or retrieves whether the current date is selected for the calendar behavior.
Sets or retrieves a value that indicates whether the document fragment inherits the Cascading Style Sheets (CSS) styles set in the primary document.
Sets or retrieves the document object that supplies content to the master element.
Declares the element behavior as a document fragment.
Sets or retrieves a value that indicates whether the master element of a viewlink is included in the tab sequence of the primary document.
Sets or retrieves the container width of the mpc behavior.
Obsolete. Retrieves the horizontal resolution of the screen.
The WSDL returned by a Web Service after an invocation of the useService method.
Retrieves a reference to the XML
Declares a namespace for custom tags in an HTML document.
Sets or retrieves the current year for the calendar behavior.
Events
Fires when the color is changed for the colorpick behavior.
Fires when a tab is selected for the mpc behavior.
Fires when the value of the slider behavior changes.
Fires when all entries in the menu are closed by invoking the closeAll method for the menu behavior.
Fires when a menu node is closed for the menu behavior.
Fires when the dataselect behavior populates the contents of a select element.
Fires for the movable behavior when the user continuously drags an element.
Fires on the element for the movable behavior when the user ends a drag operation.
Fires on the element for the movable behavior when the user first starts a drag operation.
Fires when a property is assigned an invalid value, or the property is read-only, for the colorpick behavior.
Fires when a property is assigned an invalid value, or the property is read-only, for the mask behavior.
Fires when a property is assigned an invalid value, or the property is read-only, for the menu behavior.
Fires when a property is assigned an invalid value, or the property is read-only, for the movable behavior.
Fires when a property is assigned an invalid value, or the property is read-only, for the rowover behavior.
Fires when an incorrect value is set for the slider behavior changes.
Fires when a property is assigned an invalid value, or the property is read-only, for the ToolTip behavior.
Fires when all entries in the menu are expanded by invoking the expandAll method for the menu behavior.
Fires when a menu node is expanded for the menu behavior.
Fires when a tab is selected for the mpc behavior.
Fires when the ToolTip behavior is no longer visible.
Fires from a persistent element when the page reloads.
Fires when a property value is changed for the calendar behavior.
Fires when a result has been received from a remote method callService using the WebService behavior.
Fires when a table row is selected for the rowover behavior.
Fires when the mouse cursor exits a row for the rowover behavior.
Fires when the mouse cursor enters a row for the rowover behavior.
Fires from a persisted element when the Web page is saved or bookmarked, or when the user navigates away from the page.
Fires after the WebService behavior has attempted to obtain the WSDL from a Web Service.
Fires when the ToolTip is displayed for the ToolTip behavior.
Methods
Creates a new namespace object and adds it to the collection.
Attaches a behavior to the element.
Obsolete. Adds the specified component to the queue of components to be installed.
Adds a DirectAnimation behavior (DABehavior class) to the run list when the behavior is not part of the animation model.
Calls a method that is implemented on a Web Service.
Obsolete. Clears the queue of all component download requests.
Closes all menu items for the menu behavior.
Closes the specified menu node for the menu behavior.
Obsolete. Compares two version numbers.
Creates an instance of call object that can be passed as a parameter to the callService method.
Creates a useOptions object that can be passed as a parameter to the useService method.
Unbinds the specified function from the event, so that the function stops receiving notifications when the event fires.
Downloads all the components that have been queued using addComponentRequest.
Dynamically imports an element behavior.
Expands all menu items for the menu behavior.
Expands the specified menu node for the menu behavior.
Retrieves the value of the specified attribute.
Obsolete. Retrieves the version of the specified component.
Retrieves whether the specified component is available.
Deprecated. Determines whether the specified URL refers to the client's home page.
Loads an object participating in userData persistence from a UserData store.
Moves the upper-left corner of the element to the specified location for the movable behavior.
Navigates the window to the specified location and displays the contents in folder view.
Navigates the window or frame to the specified location and displays the contents in folder view.
Navigates the browser to a user's home page.
Removes the specified attribute from the object.
Detaches a behavior from the element.
Removes a DirectAnimation behavior (DABehavior) class added by the addDABehavior method.
Unselects the selected table row for the rowover behavior.
Saves an object participating in userData persistence to a UserData store.
Sets the value of the specified attribute.
Deprecated. Sets a user's home page to the specified value.
Snaps the element to the grid as defined by the mv--grid attribute for the movable behavior.
Downloads the specified file.
Retrieves a collection of all objects to which a specified behavior is attached.
Establishes a friendly name for a Web Service URL that can be referenced from script.
Collections
Returns a collection of Uniform Resource Name (URN) strings identifying the behaviors attached to the element.
Retrieves a collection of namespace objects.
Elements and Objects
A script object that can be passed as a parameter to the callService method.
Programmatically sets default properties on an element behavior.
This object is exposed by the result object if an error is encountered from an invocation of the callService method. The properties of errorDetail provide detailed information and diagnostics on the error.
Dynamically imports an element behavior into a document.
This object exposes the results and brief diagnostics for an invocation of the callService method.
An object that can be passed as a parameter to the useService method.