tcl-websh-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ronnie Brunner <ronnie.brun...@netcetera.ch>
Subject Re: Can I use JavaScript in a HTML page which build by Websh?
Date Fri, 03 Mar 2006 07:20:23 GMT
Hi

>     If I can use JavaScript, How Use it ?
>     Can I get a example ?

Websh is a server side framework. JavaScript runs on the client ->
writing JavaScript is no different than in any other HTML page. 
The only point to consider is, that when using templates, Websh is
initially configured to expect Tcl code in curly brackets "{" and "}",
so you either have to escape tem with "\" if you want JavaScript in
your template or you reconfigure Websh to use "<?" and "?>" as code
delimiter.

Websh:

 web::puts {<script>
 function foo() {
   var i; 
   // do other stuff in JavaScript
 }
 </script>}

Regular template:

 <script>
 function foo() \{
   var i; 
   // do other stuff in JavaScript
   {web::put $someJavaScriptCode}
 \}
 </script>
 
Or, with [web::config putxmarkup tag]

 <script>
 function foo() {
   var i; 
   // do other stuff in JavaScript
   <?web::put $someJavaScriptCode?>
 }
 </script>
  
hth
Ronnie
--
Ronnie Brunner | ronnie.brunner@netcetera.ch
phone +41 (0)44 247 79 79 | fax +41 (0)44 247 70 75
Netcetera AG | 8040 Z├╝rich | Switzerland | http://netcetera.ch

---------------------------------------------------------------------
To unsubscribe, e-mail: websh-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-dev-help@tcl.apache.org


Mime
View raw message