JavaScript Reference/Javascript Collections/boundElements

Материал из Web эксперт
Версия от 08:22, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

"boundElements" Example

    
<html>
<head>
<title>Recordset Events</title>
<script language="javascript">
function rowEnter(){
    myTable.rows[myData.recordset.AbsolutePosition].style.backgroundColor = "yellow";
}
function add(){
    myData.recordset.AddNew();
}
function del(){
    if (myData.recordset.RecordCount > 0) 
        myData.recordset.Delete();
}
</script>
<script for="myTable" event="onreadystatechange">
    if (this.readyState == "complete"){
        this.rows(myData.recordset.AbsolutePosition).style.backgroundColor = "yellow";
        myData.onrowenter = rowEnter;
    }
</script>
<script for="myData" event="onrowexit">
    for (var i = 1; i <= myData.recordset.RecordCount; i++) {
       myTable.rows[i].style.backgroundColor = "";
    }
</script>
<script for="tableList" event="onclick">
    myData.recordset.AbsolutePosition = this.recordNumber;
    window.event.cancelBubble = true;
</script>
<script for="myData" event="oncellchange">alert(event.boundElements(0, 0).value);</ script>
</head>
<body>
<input id=cmdAdd type="button" value="ADD RECORD" onclick="add();">
<input id=cmdDelete type="BUTTON" value="DELETE" onclick="del();">
<object classid="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83" id="myData">
    <param name ="DataURL" value="myfile.csv">
    <param name="UseHeader" value="True">
    <param name="TextQualifier" value=""">
</object>
<table>
    <tr>
        <td>First Name</td>
    </tr>    
    <tr>
        <input id="firstname" type="text" datasrc="#myData" datafld="firstname"></td>
    </tr>
    <tr>
        <td>Last Name</td>
        <td><input id="lastname" type="text" datasrc="#myData" datafld="lastname"></td>
    </tr>
</table>
<table id="myTable" datasrc="#myData">
    <thead>
        <tr style="font-weight:bold">
            <td>First</td>
            <td>Last</td>
        </tr>
    </thead>
    <tbody>
    <tr id="tableList">
        <td><span datafld="firstname"></span></td>
        <td><span datafld="lastname"></span></td>
    </tr>
    </tbody>
</table>
</body>
</html>

<!-- myfile.csv  -->
<!-- 
Contents of relatives.csv:
firstname:string,lastname:string
A,B
C,D
E,F
-->



"boundElements" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |event                                                         |
+----------------+--------------------------------------------------------------+



"boundElements" JavaScript properties and JavaScript methods

JavaScript properties and JavaScript methods
 
item(), length, namedItem(), tags(), urns()



"boundElements" Syntax Parameters and Note

Note:
Returns an array of all elements bound to a data set. 
Only the following data-related events are affected: 
onAfterUpdate, 
onBeforeUpdate, 
onCellChange, 
onDataAvailable, 
onDatasetChanged, 
onDatasetComplete, 
onErrorUpdate, 
onRowEnter, 
onRowExit, 
onRowsDelete, and 
onRowsInserted.
    
Syntax:
    
event.boundElements // returns all bound elements
event.boundElements(param1, param2) // returns an individual bound element

    param1   Required; zero-based index or 
                       the desired member"s id or name attribute.
                       
    param2   Optional; zero-based index for the result returned
                       if param1 matches more than one element.