In OL, anything with an ID is a global variable:
You could just say:
foo.setAttribute('visible', false);
Or, if you have a named element inside another:
<view id="top">
<view name="inner">
top.inner.setAttribute('visible', false);
Or
var bar = 'inner';
top[bar].setAttribute('visible', false);
Hopefully one of those will work for you.
If you _must_ access a global variable by name:
var topview = globalValue('top');
See also: http://jira.openlaszlo.org/jira/browse/LPP-6837
On 2010-04-21, at 09:45, 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
>
>
>
>