I think you'd want global[bar].setAttribute(...). The global object should have entries for all globals, so you can use the dynamic property lookup feature of JavaScript (foo[bar]) to do that...

Regards,
Max Carlson
OpenLaszlo.org

On 4/21/10 6:45 AM, Michaela Merz wrote:

I am trying to hide a videoview. For whatever reason, it won't work with
name, only with id.

Now suppose I have

<videoview id="foo" [..] />

var bar = "foo";

Javascript:

var ix = document.getElementById(bar);
ix.doSomething();

OL:

bar.setAttribute("visible","0"); ->  Failed

How am able able to access 'setAttribute' when the id of the element is
within a variable?

Thanks.

Michaela




Reply via email to