Connecting Tech Pros Worldwide Forums | Help | Site Map

Disabled property issue with JS objects

Newbie
 
Join Date: Apr 2007
Posts: 21
#1: May 19 '07
Hi All,

I am using this funcion to manipulate form elements;
every thing works fine except the reference to the disabled property.

Any help (the property works fine when used in classic manner)?

Thanks!

G

function getObj(name)
{
if (document.getElementById)
{
this.obj = document.getElementById(name);
this.style = document.getElementById(name).style;
this.disabled = document.getElementById(name).disabled;
}
else if (document.all)
{
this.obj = document.all[name];
this.style = document.all[name].style;
this.disabled = document.all[name].disabled;
}
else if (document.layers)
{
this.obj = document.layers[name];
this.style = document.layers[name];
this.disabled = document.layers[name].disabled;
}
}

acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: May 21 '07

re: Disabled property issue with JS objects


I can only assume that you're trying to access an object which doesn't support the disabled property.
Reply