Possible duplicate:
javascript object, access variable property name?
I was messing around with JS while studying stuff, and I'm curious about something ... Let's say you have the aFunc() function and you accept the aFunc(val) . The value is user defined and then used to change the CSS element.
Example:
function aFunc(val){ document.getElementById('something').style.val = 'red'; }
Say the user has entered borderColor , he will somehow fail borderColor , where val . I do not know how and if it is possible.
EDIT: Please don't eval() :)
source share