Topic: changing css classes (Page 1 of 1) |
|
---|---|
Bipolar (III) Inmate From: |
posted 11-14-2007 17:26
Hullo. code: <script type="text/javascript"> // ** Pages <div>isions handler script var divs = null; var links = null; function init(){ links = document.getElementById("menu").getElementsByTagName("a"); var tempDivs = document.getElementsByTagName("div"); for(i = 0; i<tempDivs.length; i++){ if(tempDivs[i].className == "serverBlock"){ alert(i); } } } window.onload = init; </script> |
Paranoid (IV) Inmate From: Madison, Indiana |
posted 11-14-2007 19:24 |
Bipolar (III) Inmate From: |
posted 11-14-2007 23:45
Intranet, NDA on the page content, and I am still striving with the domain name for publishing stuff |
Paranoid (IV) Inmate From: Umeå, Sweden |
posted 11-15-2007 14:40
className is part of the DOM, every browser more recent than nn4 supports it |
Paranoid (IV) Inmate From: London |
posted 11-26-2007 18:17
This may sounds silly, but does changing your for loop to the following help any? code: for(i = 0; i<tempDivs.length; i++){ var currentDiv = tempDivs[i]; if(currentDiv.className == "serverBlock"){ alert(i); } }
|
Bipolar (III) Inmate From: Missoula, MT |
posted 12-08-2007 10:13
As far as finding reference docs in the future, a good place to start is msdn, where the pages include a "Standards Information" section near the bottom. |