summaryrefslogtreecommitdiff
path: root/test/js/dom-element-attribute.html
blob: c2a50b7f7d7fd773742bf3786b122f5fff64e24e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!DOCTYPE html>
<html>
<head>
<title>element set remove attribute</title>
<link rel="stylesheet" type="text/css" href="tst.css">
</head>
<body>
<h1>HTMLElement test of attribute set/remove</h1>

<noscript><p>Javascript is disabled</p></noscript>
<script>
    var e = document.createElement("Div");
    var t = document.createTextNode("Some text in a div.");
    e.appendChild(t);
    e.setAttribute("id", "test");
    document.body.appendChild(e);
</script>
<script>
    var test = document.getElementById("test");
    document.write("<p>The div has id: ''", test.id, "''.</p>");
    document.write("<p>Removing ID attribute...");
    test.removeAttribute("ID");
    document.write("<p>The div has id: ''", test.id, "''.</p>");
</script>

</body>
</html>