| <html> |
| <head> |
| <script language="javascript"> |
| function test() |
| { |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| var frm = document.getElementById("frm"); |
| var tf = document.getElementById('tf'); |
| tf.setAttribute('value', 'Almost Original Value'); |
| tf.value = "New value"; |
| log('Markup: ' + String(frm.innerHTML)); |
| log('Value: ' + tf.value); |
| log('Attribute: ' + tf.getAttribute('value')); |
| frm.reset(); |
| log('After reset'); |
| log('Markup: ' + String(frm.innerHTML)); |
| log('Value: ' + tf.value); |
| log('Attribute: ' + tf.getAttribute('value')); |
| } |
| |
| var console_messages = document.createElement("ol"); |
| |
| function log(message) |
| { |
| var console = document.getElementById('console'); |
| var item = document.createElement("li"); |
| item.appendChild(document.createTextNode(String(message).replace(/0x[0-9a-fA-F]{8}/g, "0xXXXXXXXX"))); |
| console.appendChild(item); |
| } |
| |
| </script> |
| </head> |
| <body onload="test()"> |
| This tests that the JS property value and the attribute value for a hidden input field are the same.<br> |
| <form id="frm"> |
| <input type="hidden" id="tf" value="Original value"> |
| </form> |
| <div id="console"></div> |
| </body> |
| </html> |