[Zope-CMF] Thanks and another question...

Chris Withers chrisw@nipltd.com
Thu, 27 Mar 2003 10:10:00 +0000


Braun Brelin wrote:
> 
> Now I have one more question.  I want to integrate TAL
> and JavaScript.  I want, for instance to be able to
> define a variable using TAL (tal:define="foo bar")
> and use variable foo in a JavaScript statement. 
> like document.write("foo = " + foo)

What you're directly asking for isn't possible. TAL is a server side language. 
Javascript is a client side language.

> I tried doing something like the following:
> 
> <div tal:define="foo 3"
>      tal:content="structure string: 
>      <script = 'JavaScript' type='text/JavaScript'
>         document.write("foo = " + ${foo});
>      </script>
>      ">Dummy Text
>      </div>

This is useign TAL to generate the Javascript on the server. Is that what you mean?

cheers,

Chris