irish
09-26-2007, 11:00 AM
How do I test if an object has properties? As you see below, I am iterating through a list of ids, in order to get the value of each. However in some instances, not all id elements will be on the page.
What I am looking for is something like 'hasproperties()' so that I could say:
if (hasproperties( document.getElementById('GG_'+id))){
other code...
}
I am currently getting a js error if the getElementById('GG_'+id) is not on found on the page.
var ids = document.getElementById('ggids').value;
var tmp = ids.split(',');
for(i=0;i<tmp.length;i++){
var id = tmp[i];
var qty = document.getElementById('GG_'+id).value;
other code...
}
What I am looking for is something like 'hasproperties()' so that I could say:
if (hasproperties( document.getElementById('GG_'+id))){
other code...
}
I am currently getting a js error if the getElementById('GG_'+id) is not on found on the page.
var ids = document.getElementById('ggids').value;
var tmp = ids.split(',');
for(i=0;i<tmp.length;i++){
var id = tmp[i];
var qty = document.getElementById('GG_'+id).value;
other code...
}