30 instead of 10. Python tutorial looks better.
[elinks.git] / test / ecmascript / forms.namedItem.html
blobd624a31a8afdeb99a88dca0b8e07fbf7e3b9ff1a
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <HTML>
3 <HEAD>
4 <TITLE>forms.namedItem variations</TITLE>
5 </HEAD>
6 <BODY>
7 <FORM name="f" action="#">
8 <P><BUTTON name="b" type="button">dummy</BUTTON></P>
9 </FORM>
10 <SCRIPT type="application/ecmascript">
11 function stringify(val)
13 var str = typeof(val);
14 var first = true;
15 if (str != "object" || val === null) {
16 str += " " + val;
17 } else {
18 str += " {";
19 for (var prop in val) {
20 if (!first) str += ", ";
21 first = false;
22 str += prop;
24 str += "}";
26 return str;
28 </SCRIPT>
29 <SCRIPT type="application/ecmascript">
30 // iceweasel 2.0+dfsg-1: object {b, nodeName, nodeValue, nodeType, parentNode, childNodes...
31 // ELinks 0.11.3: object {action, elements, encoding, length, method, name, target}
32 window.alert("document.forms.f=" + stringify(document.forms.f));
33 </SCRIPT>
34 <SCRIPT type="application/ecmascript">
35 // iceweasel 2.0+dfsg-1: object {b, nodeName, nodeValue, nodeType, parentNode, childNodes...
36 // ELinks 0.11.3: object {action, elements, encoding, length, method, name, target}
37 window.alert("document.forms[\"f\"]=" + stringify(document.forms["f"]));
38 </SCRIPT>
39 <SCRIPT type="application/ecmascript">
40 // iceweasel 2.0+dfsg-1: object {b, nodeName, nodeValue, nodeType, parentNode, childNodes...
41 // ELinks 0.11.3: TypeError: document.forms.namedItem is not a function
42 window.alert("document.forms.namedItem(\"f\")=" + stringify(document.forms.namedItem("f")));
43 </SCRIPT>
44 <SCRIPT type="application/ecmascript">
45 // iceweasel 2.0+dfsg-1: undefined undefined
46 // ELinks 0.11.3: object null
47 window.alert("document.forms.notfound=" + stringify(document.forms.notfound));
48 </SCRIPT>
49 <SCRIPT type="application/ecmascript">
50 // iceweasel 2.0+dfsg-1: undefined undefined
51 // ELinks 0.11.3: object null
52 window.alert("document.forms[\"notfound\"]=" + stringify(document.forms["notfound"]));
53 </SCRIPT>
54 <SCRIPT type="application/ecmascript">
55 // iceweasel 2.0+dfsg-1: object null
56 // ELinks 0.11.3: TypeError: document.forms.namedItem is not a function
57 window.alert("document.forms.namedItem(\"notfound\")=" + stringify(document.forms.namedItem("notfound")));
58 </SCRIPT>
59 </BODY>
60 </HTML>