document.styleSheets[0].rules[0] подходит. Но это не серьезно. Если например добавятся классы, то придется менять цыфры. Попробовал так:
CODE:for(int ii=0;document.getElementById('id1').className! = document.styleSheets[0].rules[ii].selectorText.substring( document.styleSheets[0].rules[ii].selectorText.indexOf('.') + 1, document.styleSheets[0].rules[ii].selectorText.length); ii++){
}
почему то не находит нужный ii, хотя
CODE:document.getElementById('id1').className == document.styleSheets[0].rules[ii].selectorText.substring( document.styleSheets[0].rules[ii].selectorText.indexOf('.') +1, document.styleSheets[0].rules[ii].selectorText.length)
если подставить нужные числа.
Хотелось бы что то вроде document.styleSheets.all['id1']...

т.е. чтоб можно было сразу имя класса указывать или из document.getElementById('id1'

.className брать