Can I use JavaScript in a HTML page which build by Websh?

View: New views
2 Messages — Rating Filter:   Alert me  

Can I use JavaScript in a HTML page which build by Websh?

by Wim Wan :: Rate this Message:

| View Threaded | Show Only this Message

Hello:
 
    If I can use JavaScript, How Use it ?
    Can I get a example ?
 
    Thanks .
 

Wim Wan
2006-03-03

Re: Can I use JavaScript in a HTML page which build by Websh?

by Ronnie Brunner :: Rate this Message:

| View Threaded | Show Only this Message

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@...
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@...
For additional commands, e-mail: websh-dev-help@...