summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/js/document-url.html31
-rw-r--r--test/js/event-onclick.html30
-rw-r--r--test/js/event-onload.html10
-rw-r--r--test/js/index.html19
4 files changed, 84 insertions, 6 deletions
diff --git a/test/js/document-url.html b/test/js/document-url.html
new file mode 100644
index 000000000..2299b5775
--- /dev/null
+++ b/test/js/document-url.html
@@ -0,0 +1,31 @@
+<html>
+<head>
+<title>document location and URL interface</title>
+<link rel="stylesheet" type="text/css" href="tst.css">
+</head>
+<body>
+<h1>document location and URL interface</h1>
+
+<h2>Document location enumeration</h2>
+<script>
+function output(x,y) {
+ document.body.appendChild(document.createTextNode(x));
+ document.body.appendChild(document.createTextNode("("));
+ if (y != undefined) {
+ document.body.appendChild(document.createTextNode(y.length));
+ }
+ document.body.appendChild(document.createTextNode(") = "));
+ document.body.appendChild(document.createTextNode(y));
+ document.body.appendChild(document.createElement('br'));
+}
+
+for(var key in document.location) {
+ output(key, document.location[key]);
+}
+</script>
+<h2>Document URL</h2>
+<script>output("document.URL", document.URL);</script>
+<h2>DocumentURI</h2>
+<script>output("document.documentURI", document.documentURI);</script>
+</body>
+</html>
diff --git a/test/js/event-onclick.html b/test/js/event-onclick.html
new file mode 100644
index 000000000..b2060e517
--- /dev/null
+++ b/test/js/event-onclick.html
@@ -0,0 +1,30 @@
+<html>
+<head>
+<title>alert onclick example</title>
+
+<script type="text/javascript">
+
+function causealert()
+{
+var txt = document.getElementById("p1").textContent;
+alert(txt);
+}
+
+</script>
+</head>
+
+<body>
+<div style="border: 1px solid red">
+<p id="p1">First line of paragraph.<br /></p>
+</div><br />
+
+<button id="button1" >add another textNode.</button>
+
+<script>
+var button = document.getElementById("button1");
+
+button.onclick = causealert;
+</script>
+
+</body>
+</html>
diff --git a/test/js/event-onload.html b/test/js/event-onload.html
index aede985a4..cd9e70543 100644
--- a/test/js/event-onload.html
+++ b/test/js/event-onload.html
@@ -6,9 +6,7 @@
function addTextNode()
{
-var newtext = document.createTextNode(" Some text added dynamically. ");
-var para = document.getElementById("p1");
-para.appendChild(newtext);
+para.appendChild(document.createTextNode(" Some text added dynamically. "));
}
</script>
@@ -19,10 +17,14 @@ para.appendChild(newtext);
<p id="p1">First line of paragraph.<br /></p>
</div><br />
-<button onclick="addTextNode();">add another textNode.</button>
+<button id="button1" >add another textNode.</button>
<script>
+var button = document.getElementById("button1");
+var para = document.getElementById("p1");
+
window.onload = addTextNode;
+button.onclick = addTextNode;
</script>
</body>
diff --git a/test/js/index.html b/test/js/index.html
index 7a17c95d3..bb2918cac 100644
--- a/test/js/index.html
+++ b/test/js/index.html
@@ -5,12 +5,15 @@
</head>
<body>
<h1>JavaScript Tests</h1>
+
+
<h2>Window</h2>
<ul>
<li><a href="window.lately.html">location</a></li>
<li><a href="window-enumerate.html">enumerate</a></li>
</ul>
+
<h2>Document write</h2>
<ul>
<li><a href="inline-doc-write-simple.html">Simple document write</a></li>
@@ -22,7 +25,9 @@
<li><a href="inline-innerhtml.html">Inline script innerHtml test</a></li>
</ul>
+
<h2>DOM tests</h2>
+
<h3>Reference method tests</h3>
<ul>
<li><a href="dom-element-firstElementChild.html">firstElementChild</a></li>
@@ -31,24 +36,34 @@
<li><a href="dom-element-childElementCount.html">childElementCount</a></li>
<li><a href="doc-dom2.html">getElementById</a></li>
<li><a href="dom-getElementsByTagName.html">getElementsByTagName</a></li>
-
</ul>
+
<h3>Enumeration tests</h3>
<ul>
<li><a href="dom-node-enumerate.html">Node element interface</a></li>
<li><a href="dom-body-enumerate.html">Body element interface</a></li>
<li><a href="dom-document-enumerate.html">Document interface</a></li>
</ul>
+
<h3>Document element specific</h3>
<ul>
<li><a href="dom-doc-cookie.html">Cookie dispaly (only from server)</a></li>
<li><a href="dom-doc-location.html">location</a></li>
</ul>
+
+
+<h2>Dom events</h2>
+<ul>
+<li><a href="event-onload.html">window.onload</a></li>
+<li><a href="event-onclick.html">button.onclick</a></li>
+</ul>
+
+
<h2>Assorted</h2>
<ul>
<li><a href="assorted-log-doc-write.html">console.log and document.write</a></li>
-
<li><a href="wikipedia-lcm.html">Example from wikipedia</a></li>
</ul>
+
</body>
</html>