1 |
<!DOCTYPE html> |
2 |
<html lang="en"> |
3 |
<head> |
4 |
<title>Element['class']</title> |
5 |
<script src="../../../support/result0.js"></script> |
6 |
<style type="text/css"> |
7 |
p { |
8 |
color: orange; |
9 |
} |
10 |
p.value-of-the-class-attribute { |
11 |
color: green; |
12 |
} |
13 |
p.new-value-of-the-class-attribute { |
14 |
color: blue; |
15 |
} |
16 |
</style> |
17 |
</head> |
18 |
<body> |
19 |
|
20 |
<div><p id="a">XXXXXX</p></div> |
21 |
|
22 |
<script type="text/javascript"> |
23 |
var a = document.getElementById ('a'); |
24 |
a['class'] = 'new-value-of-the-class-attribute'; |
25 |
|
26 |
document.write ('<dl><dt><code><var>Element</var>["class"]</code></dt><dd>'); |
27 |
writeResult (a['class']); |
28 |
document.write ('</dd><dt><code><var>Element</var>.getAttribute ("class")</code><dd>'); |
29 |
writeResult (a.getAttribute ('class')); |
30 |
document.write ('</dd><dt><code><var>Element</var>.parentNode.innerHTML</code></dt><dd>'); |
31 |
document.write (htescape (a.parentNode.innerHTML)); |
32 |
document.write ('</dd></dl>'); |
33 |
</script> |
34 |
|
35 |
</body> |
36 |
</html> |