This is sorta hard to explain, for example I have div.style.color = 'variable here' which works fine. However, what I really want is div.style.'variable here' = 'another variable here'. But doing that results in an error. Div is getelementbyid by the way, referencing a specific div in my HTML. Any ideas? Or is it impossible to do it this way? It's so I can pick what style to customize through an input box
In Javascript, there's barely any difference (if any) between an object and an associative array. That said, you can just use div.style[stylename] = stylevalue; just as if it were an array.
[QUOTE=Darkwater124;42987121]In Javascript, there's barely any difference (if any) between an object and an associative array. That said, you can just use div.style[stylename] = stylevalue; just as if it were an array.[/QUOTE]
Thanks a lot! This never came up in Google. Works perfect
Sorry, you need to Log In to post a reply to this thread.