Hello yudi,
Thanks for the response. My question is related to accessing global variables from inside javascript functions. The above example is showing the access model within XEL. What if the event handler type was text/javascript?
your xml variable are not well defined, "Hello!" isen't a xml document. Test with the following code. I write a valid xml document into "myVar" variable. I use bb.xml serialize to view xml document as string.
How do I access global variable inside a script?
31 December, 2007 - 16:16 — yudiHi Risala,
Just type the variable name after $ sign.Here is an example:
<e:handler event="click" type="application/xml">
<c:create destination="id('window_area')" mode="appendChild" >
<b:window >
<c:attribute name="id" select="$myVar"/>
</b:window>
</c:create>
</e:handler>
</button>
global var inside javascript
9 January, 2008 - 17:38 — risalaHello yudi,
Thanks for the response. My question is related to accessing global variables from inside javascript functions. The above example is showing the access model within XEL. What if the event handler type was text/javascript?
global var inside javascript
10 January, 2008 - 01:32 — yudiHi risala,
If there is no other word other than the variable name , then you can type it directly otherwise add + to separate between them. For example:
alert('Property ' + name + ' is: ' + value);
this._._yourWidget = value;
</d:setter>
You can just use the name of
11 January, 2008 - 10:10 — SjoerdYou can just use the name of the variable directly just as you would access a global javascript variable
<e:data>
<root />
</e:data>
</e:variable>
<div>
Click me
<e:handler event="click" type="application/javascript">
alert(myVar);
</e:handler>
</div>
When I do this.. the alert show.. Undefined
23 July, 2008 - 22:09 — dfletcherWhen I do this.. the alert show.. Undefined
<e:data type="text/xml">
Hello!
</e:data>
</e:variable>
<div>
Click me
<e:handler event="click" type="application/javascript">
alert(myVar);
</e:handler>
</div>
Xml format
24 July, 2008 - 07:21 — huanhoyour xml variable are not well defined, "Hello!" isen't a xml document. Test with the following code. I write a valid xml document into "myVar" variable. I use bb.xml serialize to view xml document as string.
<e:data type="text/xml">
<root xmlns="">
<p>Hello!</p>
</root>
</e:data>
</e:variable>
<div>
Click me
<e:handler event="click" type="application/javascript">
alert(bb.xml.serialize(myVar));
</e:handler>
</div>