JavaScript Reference/Event Handlers Reference/onBeforeUpdate

Материал из Web эксперт
Перейти к: навигация, поиск

"onBeforeUpdate" Example

    
<html>
<head>
<title>Recordset Events</title>
<script for="firstname" event="onbeforeupdate">
    alert("Data is about to change");
</script>
</head>
<body>
<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>
       <td><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  -->
<!--
firstname:string,lastname:string
Joe,Yin
Jason,Lee
Tony,Zhang
-->



"onBeforeUpdate" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<a>                             <applet>                      |
|                |<bdo>                           <button>                      |
|                |<caption>                       <custom>                      |
|                |<div>                           <frame>                       |
|                |<frameset>                      <iframe>                      |
|                |<img>                           <input type="checkbox">       |
|                |<input type="hidden">           <inputtype="password">        |
|                |<input type="radio">            <input type="text">           |
|                |<label>                         <legend>                      |
|                |<map>                           <marquee>                     |
|                |<object>                        <rt>                          |
|                |<ruby>                          <select>                      |
|                |<span>                          <table>                       |
|                |<td>                            <textarea>                    |
|                |<tr>                                                          |
+----------------+--------------------------------------------------------------+



"onBeforeUpdate" Properties

+----------------+--------------------------------------------------------------+
| Properties     |altKey                          altLeft                       |
|                |cancelBubble                    clientX                       |
|                |clientY                         ctrlLeft                      |
|                |offsetX                         offsetY                       |
|                |returnValue                     screenX                       |
|                |screenY                         shiftLeft                     |
|                |srcElement                      type                          |
|                |x                               y                             |
+----------------+--------------------------------------------------------------+



"onBeforeUpdate" Syntax and Note

Note:
    
This event fires before a databound object is updated.
 
The datasrc and datafld attributes must be set to the 
onBeforeUpdate event handler elements. 
The value of the datasrc attribute must reference an object in the page.