gecko-dev/rdf/resources/dom-test-4.xul

59 строки
1.3 KiB
XML

<!--
This test exercises some of the Level 1 Core DOM APIs.
-->
<?xml-stylesheet type="text/css" href="dom-test-4.css"?>
<foo:foo xmlns:foo="http://foo.bar.com/xml#" xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<html:script>
function swap()
{
var barElements = document.getElementsByTagName("bar");
var child1 = barElements[1];
dump("child1 = " + child1 + "\n");
var child2 = barElements[2];
dump("child2 = " + child2 + "\n");
var parent = child1.parentNode;
dump("parent = " + parent + "\n");
parent.insertBefore(child2, child1);
}
function toggleColor()
{
var barElements = document.getElementsByTagName("bar");
var child1 = barElements[1];
if (child1.getAttribute("enabled")) {
child1.removeAttribute("enabled");
}
else {
child1.setAttribute("enabled", "true");
}
}
</html:script>
<html:input name="b1"
type="button"
value="Swap"
onclick="swap();"/>
<html:input name="b2"
type="button"
value="Toggle #2's Color"
onclick="toggleColor();"/>
<foo:bar>This</foo:bar>
<foo:bar id="one">is</foo:bar>
<foo:bar id="two">really</foo:bar>
<foo:bar>great</foo:bar>
</foo:foo>