| function print(message, color) |
| var paragraph = document.createElement("div"); |
| paragraph.appendChild(document.createTextNode(message)); |
| paragraph.style.fontFamily = "monospace"; |
| paragraph.style.color = color; |
| document.getElementById("console").appendChild(paragraph); |
| document.getElementById('div1').onsubmit = function () { |
| return false; // returning false cancels form submission |
| document.getElementById('input1').click(); |
| print("PASS: containing element " + id + " caught submit event", "green"); |
| print("FAIL: containing element did not cancel submit event", "red"); |
| <p>This page tests whether the form 'submit' event bubbles to containing elements. |
| If it passes, you'll see 'PASS' messages below.</p> |
| <div id="div2" onsubmit="pass(this.id);"> |
| <form id="form1" action="javascript:fail();"> <!-- only executes if form submits --> |
| <input id="input1" type="submit"> |