JavaScript Reference/Event Handlers Reference/onPropertyChange — различия между версиями

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

Текущая версия на 08:22, 26 мая 2010

"onPropertyChange" Example

    
<html>
<head>
<script language="JavaScript">
<!--
function styleProp() {
   if (myDiv.style.backgroundColor == "gray"){
       myDiv.style.backgroundColor = "red"; 
       return;
   }
   if (myDiv.style.backgroundColor == "red"){
       myDiv.style.backgroundColor = "blue"; 
       return;
   }
   if (myDiv.style.backgroundColor == "blue"){
       myDiv.style.backgroundColor = "green"; 
       return;
   }
   if (myDiv.style.backgroundColor == "green"){
       myDiv.style.backgroundColor = "orange"; 
       return;
   }
   if (myDiv.style.backgroundColor == "orange"){
       myDiv.style.backgroundColor = "gray"; 
       return;
   }
} 
function final() {
   alert("backgroundColor property has changed value!"); 
} 
--> 
</script>
</head>
<body bottommargin=150>
    <div id="myDiv" 
         style="width:500; 
                height:200; 
                cursor:hand; 
                color: white; 
                background-color:gray" 
         onclick="styleProp()" 
         onpropertychange="final();">
         Click here to change the background color of this box.
    </div>
</body>
</html>



"onPropertyChange" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |<a>                             <address>                     |
|                |<applet>                        <area>                        |
|                |<b>                             <bdo>                         |
|                |<big>                           <blockquote>                  |
|                |<body>                          <button>                      |
|                |<caption>                       <center>                      |
|                |<cite>                          <code>                        |
|                |<comment>                       <custom>                      |
|                |<dd>                            <dfn>                         |
|                |<dir>                           <div>                         |
|                |<dl>                            document                      |
|                |<dt>                            <em>                          |
|                |<embed>                         <fieldset>                    |
|                |<font>                          <form>                        |
|                |<hn>                            <hr>                          |
|                |<i>                             <img>                         |
|                |<input type="button">           <input type="checkbox">       |
|                |<inputtype="file">              <input type="hidden">         |
|                |<input type="image">            <input type="password">       |
|                |<input type="radio">            <input type="reset">          |
|                |<input type="submit">           <inputtype="text">            |
|                |<kbd>                           <label>                       |
|                |<legend>                        <li>                          |
|                |<listing>                       <map>                         |
|                |<marquee>                       <menu>                        |
|                |<nobr>                          <object>                      |
|                |<ol>                            <option>                      |
|                |<p>                             <pre>                         |
|                |<s>                             <samp>                        |
|                |<script>                        <select>                      |
|                |<small>                         <span>                        |
|                |<strike>                        <strong>                      |
|                |<sub>                           <sup>                         |
|                |<table>                         <tbody>                       |
|                |<td>                            <textarea>                    |
|                |<tfoot>                         <th>                          |
|                |<thead>                         <tr>                          |
|                |<tt>                            <u>                           |
|                |<ul>                            <var>                         |
|                |<xmp>                                                         |
+----------------+--------------------------------------------------------------+



"onPropertyChange" Properties

+----------------+--------------------------------------------------------------+
| Properties     |altKey                          altLeft                       |
|                |ctrlLeft                        propertyName                  |
|                |shiftLeft                       srcElement                    |
|                |type                                                          |
+----------------+--------------------------------------------------------------+



"onPropertyChange" Syntax and Note

Note:
    
This event fires when an object"s property changes.