sorry, i should point out that since you're using a .js file, you
won't have <script> tags. just declare the variable outside of any
function calls and the same holds true. it'll be globally available
to any of the functions.
On 4/20/07, Charlie Griefer <[EMAIL PROTECTED]> wrote:
> not unless you explicitly call the first function from within the 2nd.
>
> JavaScript acts the way that I wish CFCs would act. If you declare a
> variable inside a function, it's local to that function.
>
> If you have multiple functions that need to reference a variable, just
> declare the variable inside the <script> tag but outside of any
> functions.
>
> e.g.
>
> <script type="text/javascript">
> var foo = 1;
>
> function doFoo() {
> var bar = 2;
> alert(foo);
> alert(bar);
> }
> function doMoreFoo() {
> alert(foo);
> alert(bar); // this will explode
> }
> </script>
>
> both of the above functions have access to 'foo'. but only the first
> function has access to 'bar'.
>
>
> On 4/20/07, Scott Stewart <[EMAIL PROTECTED]> wrote:
> > Hey all,
> >
> >
> >
> > I've got two javascript functions in a .js template.
> >
> >
> >
> > If I set a var in the first function, can I use it in the second function?
> >
> >
> >
> > Thanks
> >
> >
> >
> > sas
> >
> >
> >
> > --
> >
> > Scott Stewart
> >
> > ColdFusion Developer
> >
> >
> >
> > SSTWebworks
> >
> > 7241 Jillspring Ct.
> >
> > Springfield, Va. 22152
> >
> > (703) 220-2835
> >
> >
> >
> > http://www.sstwebworks.com
> >
> >
> >
> >
> >
> >
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 and Flex 2
Build sales & marketing dashboard RIAâs for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT
Archive:
http://www.houseoffusion.com/groups/CF-Community/message.cfm/messageid:233117
Subscription: http://www.houseoffusion.com/groups/CF-Community/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.5