Can't use object properties' values

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
pilau
Forum Regular
Posts: 594
Joined: Sat Jul 09, 2005 10:22 am
Location: Israel

Can't use object properties' values

Post by pilau »

Hi.
I'm succesfully fetching an img element by it's ID, but I can't any of the properties' values, not even the id property.
I tried it both in Firefox and IE6 but to no avail.

Please help me solve this issue.

Code: Select all

// fetch_object emulates document.getElementById
// and bridges over browser compatibility (it works, the problem is not here)

var buttonIcon = fetch_object(obj.id + '_icon');
alert(buttonIcon.id);
The fetching works, but again, I can't get any of the properties' values so the alert function isn't functioning. What's even more weird, I tried the following code and it worked:

Code: Select all

for (property in buttonIcon)
{
   alert(proprty + "<br>");
}
All of the properties' names were printed out. I think I am going crazy. Why can't I get the properties values?
Post Reply