3 <title>setAttribute() Test
</title>
5 <style type=
"text/css" title=
"text/css">
7 p { display:none; color: red; }
8 p[title] { display:block; color: green; }
9 p[id] { display:block; color: green; }
10 p[class] { display:block; color: green; }
11 p[lang] { display:block; color: green; }
15 <script type=
"text/javascript">
20 document
.getElementsByTagName('p')[0].setAttribute('class','test');
21 document
.getElementsByTagName('p')[1].setAttribute('id','test');
22 document
.getElementsByTagName('p')[2].setAttribute('title','This is a test');
23 document
.getElementsByTagName('p')[4].setAttribute('lang','en');
29 <h1>setAttribute() Test
</h1>
31 This element's Class attribute is set using setAttribute(). It should be green.
34 This element's ID attribute is set using setAttribute(). It should be green.
37 This element's Title attribute is set using setAttribute(). It should be green.
39 <p title=
"This is hard-coded">
40 This element's Title attribute is hard-coded. It should be green.
43 This element's Lang attribute is set using setAttribute(). It should be green.