Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help w/Eval()

Status
Not open for further replies.

Silvano

Programmer
Jul 16, 2001
386
0
0
US
ok, java wizzes, here is my concept:

on the page I am using on click event to call the function; I am sending the element's ID:

... onclick="checkAdmin(this.id);"...

and here starts all the problems. the element's id is stored in the layerID; now, if I hard code it like this:

function checkAdmin(layerID) {
layerID = document.all.userInfoLayer.style.display;
alert(layerID);
}

the value I get is 'none' which is true and I am ok with it;
to make things more interesting, I would like to access the element's value by using something like this:

function checkAdmin(layerID) {
layerID = Eval('document.all.'+layerID+'Layer.style');
alert(layerID.display);
}

so far, no luck; can you help out here? what I am missing? I have tried numerous combinations (with quotes or without...), and I was not able to make it work Sylvano
dsylvano@hotmail.com
 
try
function checkAdmin(layerID) {
layerID = document.all[layerID + "Layer"].style
alert(layerID.display);
}
 
nope, still nothing...

I am testing in IE BTW... Sylvano
dsylvano@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top