| <title>setAttribute() Test</title> |
| <style type="text/css" title="text/css"> |
| p { display:none; color: red; } |
| p[title] { display:block; color: green; } |
| p[id] { display:block; color: green; } |
| p[class] { display:block; color: green; } |
| p[lang] { display:block; color: green; } |
| <script type="text/javascript"> |
| document.getElementsByTagName('p')[0].setAttribute('class','test'); |
| document.getElementsByTagName('p')[1].setAttribute('id','test'); |
| document.getElementsByTagName('p')[2].setAttribute('title','This is a test'); |
| document.getElementsByTagName('p')[4].setAttribute('lang','en'); |
| <h1>setAttribute() Test</h1> |
| This element's Class attribute is set using setAttribute(). It should be green. |
| This element's ID attribute is set using setAttribute(). It should be green. |
| This element's Title attribute is set using setAttribute(). It should be green. |
| <p title="This is hard-coded"> |
| This element's Title attribute is hard-coded. It should be green. |
| This element's Lang attribute is set using setAttribute(). It should be green. |