:: Forum >>

getelementbyid

i am trying to do this. no luck. can any1 pls help:

var elem = document.body.getElementsByTagName('*');
var str = "";
var s = 0;

for(i=0; i<elem.length; i++)
{
ElementNow = elem(i).id;
ProperID = ElementNow.substring(0, (ElementNow.length - 9));
if(elem(i).type == 'text')
{
ProperID = document.getElementById(ProperID);
ElementNow.setControlDisabled(true);
ProperID.setStyle('color', 'red');
}
}

basically, get all elements from the page. for each text element, apply color red
t4
Thursday, March 4, 2010
I think you need to refer to the elements in the elem array using elem[i], not elem(1).
Chris Pamplin
Friday, March 5, 2010
no luck. perhaps, just an alternate way of doing same thing.
t4
Monday, March 8, 2010

This topic is archived.


Back to support forum

Forum search