cssTextArray = document.getElementById('playground').childNodes[i].style.cssText.split(";");
ix = cssTextArray.length;
while(ix--)
{
cssTextElementsArray = cssTextArray[ix].split(":");
styleElement = trim(cssTextElementsArray[0]).toLowerCase();
styleValue = trim(cssTextElementsArray[1]);
logMessage('element: ' + styleElement + ' value: ' + styleValue);
} // end while
// trim code from http://www.apriori-it.co.uk/Trim.asp
function trim(trimValue)
{
if(trimValue.length < 1)br>
{
return "";
}
trimValue = RTrim(trimValue);
trimValue = LTrim(trimValue);
if(trimValue == "")
{
return "";
}
else
{
return trimValue;
}
} // end function
function RTrim(VALUE)
{
var w_space = String.fromCharCode(32);
var v_length = VALUE.length;
var strTemp = "";
if(v_length < 0)br>
{
return "";
}
var iTemp = v_length -1;
while(iTemp > -1)
{
if(VALUE.charAt(iTemp) == w_space)
{
}
else
{
strTemp = VALUE.substring(0,iTemp +1);
break;
}
iTemp = iTemp-1;
} //End While
return strTemp;
} //End Function
function LTrim(VALUE)
{
var w_space = String.fromCharCode(32);
if(v_length < 1)br>
{
return "";
}
var v_length = VALUE.length;
var strTemp = "";
var iTemp = 0;
while(iTemp < v_length)br>
{
if(VALUE.charAt(iTemp) == w_space)
{
}
else
{
strTemp = VALUE.substring(iTemp,v_length);
break;
}
iTemp = iTemp + 1;
} //End While
return strTemp;
} //End Function
>>>>
This really works for you in Moz? Poking at this quickly in the Javascript shell, I find that this:
output = document.getElementById('output')
output.style[5]
Doesn't get me anything, even though there is indeed a div id'd output on the page.
There's also the issue that the style object may only give you back inline styles already set on the element/object, not the computed style.
posted by weston at 7:53 AM on January 20, 2006