Possible Duplicate:
javascript object, access variable property name?
I am messing around with JS, learning a stuff and I am wondering about something...
Say you have a function aFunc()
, and you accept a string aFunc(val)
. The value is user defined and is then used to modify the CSS of an element.
For Example:
function aFunc(val){
document.getElementById('something').style.val = 'red';
}
Say the user entered borderColor
, it would somehow refrence borderColor
where val
is. I do not know how or if this is possible.
EDIT:
Please no eval()
:)