| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> |
| <html lang="en"> |
| <head> |
| <title>XMLHttpRequest and responseXML -- script in the response</title> |
| </head> |
| <body> |
| <p>The following line should say "PASS" twice, and you should not |
| get any alerts or see the word "FAIL" anywhere on the next line.</p> |
| <p>FAIL: Script did not run.</p> |
| <script type="text/javascript"> |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| var p = document.getElementsByTagName('p')[1]; |
| p.firstChild.data = 'FAIL: Test script did not finish.'; |
| window.onerror = function (error, file, line) { p.firstChild.data += ' (ERROR: ' + error + ' (line ' + line + '))'; } |
| if (!window.XMLHttpRequest) |
| window.XMLHttpRequest = function () { return new ActiveXObject("Microsoft.XMLHTTP"); } |
| var r = new XMLHttpRequest(); |
| r.open('GET', 'resources/018-test.xml', false); |
| r.send(null); |
| var form = r.responseXML.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'form')[0]; |
| form.submit(); |
| p.firstChild.data = form.firstChild.data + " " + r.responseXML.title; |
| </script> |
| </body> |
| </html> |