Click to return to the DHTML, HTML     
DATAFLDTEXT Attribute | d...     Behaviors Library    
Web Workshop  |  DHTML, HTML & CSS

dataselect Behavior


Adds databinding capabilities to the SELECT element.

Syntax

XMLN/A
HTML<SELECT STYLE="behavior:url('dataselect.htc')" >
Scriptingobject.style.behavior = "url('dataselect.htc')"
object.addBehavior ("dataselect.htc")

Members

Remarks

The behavior-defined members listed in the preceding table are not accessible through script until the window.onload event fires. Waiting for this event to fire ensures that the page is completely loaded, that all behaviors have been applied to corresponding elements on the page, and, consequently, that all the behavior's properties, methods, and events are available for scripting. Attempting to use any of the behavior-defined members will result in a scripting error indicating that the object does not support that particular member.

A data source object must be instantiated for the dataselect behavior to work. To learn more about data source objects, read the Data Binding overview. The sample included on this page provides the necessary code to instantiate a data source object.

Example

This sample demonstrates the implementation of the dataselect behavior to bind a text file to a SELECT element.

Sample Code

<HEAD>
<STYLE>
.bound{behavior: url("DataSelect.htc")}
H1{font: bold 18pt verdana; color: navy;}
P{font: 10pt verdana;}
</STYLE>
</HEAD>
<BODY>
<SELECT NAME="oTest"
   CLASS="bound"
   DATASRC="#oData"
   VALUE="4a"
   DATAFLDTEXT="column2"
   DATAFLDVALUE="column1"
</SELECT>
<!-- Data source object must be present -->
<OBJECT ID="oData" CLASSID="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83">
   <PARAM NAME="DataURL" VALUE="dataselect.txt">
   <PARAM NAME="FieldDelim" VALUE=",">
</OBJECT>
</BODY>
This feature requires Internet Explorer 5 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
SELECT

See Also

DHTML Behaviors, Using DHTML Behaviors



Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.