You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by bobby rullo <br...@alexanderinteractive.com> on 2005/03/01 23:54:05 UTC
Global Variables....in JavaScript!
Hello all,
I am creating a component with some client side scripting.
One thing that I can't figure how to get around is how to make a global
javascript variable. Normally you just do it outside of the context of a
function...but there is nowhere to do this in Tapestry that I can see - even the
initialization stuff is in a windows onload function....
Any advice?
Thanks
Bobby
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Global Variables....in JavaScript!
Posted by Wilkes Joiner <wi...@gmail.com>.
You can attach it to the window object.
window.myVariable = myVariable
On Tue, 1 Mar 2005 22:54:05 +0000 (UTC), bobby rullo
<br...@alexanderinteractive.com> wrote:
> Hello all,
>
> I am creating a component with some client side scripting.
>
> One thing that I can't figure how to get around is how to make a global
> javascript variable. Normally you just do it outside of the context of a
> function...but there is nowhere to do this in Tapestry that I can see - even the
> initialization stuff is in a windows onload function....
>
> Any advice?
>
> Thanks
>
> Bobby
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Global Variables....in JavaScript!
Posted by bobby rullo <br...@alexanderinteractive.com>.
Thanks to everyone who responded.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Global Variables....in JavaScript!
Posted by Barry Books <bf...@mac.com>.
I just put them at the top of the code in the body tag of my script
file like
<?xml version="1.0"?>
<!-- $Id: popup.script,v 1.1 2003/03/05 23:02:35 hlship Exp $ -->
<!DOCTYPE script PUBLIC
"-//Apache Software Foundation//Tapestry Script Specification
3.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Script_3_0.dtd">
<script>
<input-symbol key="url" class="java.lang.String" required="yes"/>
<body>
// global flag
var isIE = false;
On Mar 1, 2005, at 4:54 PM, bobby rullo wrote:
> Hello all,
>
> I am creating a component with some client side scripting.
>
> One thing that I can't figure how to get around is how to make a global
> javascript variable. Normally you just do it outside of the context of
> a
> function...but there is nowhere to do this in Tapestry that I can see
> - even the
> initialization stuff is in a windows onload function....
>
> Any advice?
>
> Thanks
>
> Bobby
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Global Variables....in JavaScript!
Posted by Kent Tong <ke...@cpttm.org.mo>.
bobby rullo <br <at> alexanderinteractive.com> writes:
> One thing that I can't figure how to get around is how to make a global
> javascript variable. Normally you just do it outside of the context of a
> function...but there is nowhere to do this in Tapestry that I can see -
> even the
> initialization stuff is in a windows onload function....
Use a Script component with a script file like:
<script>
<body>
<![CDATA[
var myGlobalVar;
]]>
</body>
</script>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Global Variables....in JavaScript!
Posted by "F. Da Costa Gomez" <da...@gmail.com>.
bobby rullo wrote:
> Hello all,
>
> I am creating a component with some client side scripting.
>
> One thing that I can't figure how to get around is how to make a global
> javascript variable. Normally you just do it outside of the context of a
> function...but there is nowhere to do this in Tapestry that I can see - even the
> initialization stuff is in a windows onload function....
I resolved this by using a completely hidden frame that contains *only* js code
and variables. Big advantage is the fact that the js 'stuff' is *always*
available for every page. A small drawback might be the very frame fact, a price
i'm willing to pay because of the added advantages.
my 2c
Cheers,
Fermin DCG
>
> Any advice?
>
> Thanks
>
> Bobby
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org