Re: change width of table with no id or class name...



"swwalsh" wrote:
...not all the tables will have ID's... So how can I get this to work if
a table does not have an id or class...

function showData() {

inputs = document.getElementsByTagName("table");
for (i = 0; i < inputs.length; i++) {

if (inputs[i].width > 500) {
var table = inputs[i].id;
var table2 = document.getElementById(table);
table2.setAttribute("width","400");
}
}
}

Uh...by just using the object reference?

inputs = document.getElementsByTagName("table")
for (i=0; i<inputs.length; i++)
if (inputs[i].width > 500)
inputs[i].setAttribute("width","400")



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use of this email address implies consent to these terms.

.


Loading