0

[問題]zscript的javascript不會動?

asked 2007-06-08 03:55:38 +0800

tommy1973 gravatar image tommy1973
3 2
我的範例如下:

<window title="My First Window" border="normal" width="200px">
Hello, World!
<zscript language="javascript">
function test(){
alert("This is my test code.");
}
</zscript>
<button label="Test" action="onclick:test()"/>
</window>

我已經寫了一個Javascript的 "test" function,我也有在button上用 action="onclick:test()",為什麼會出現Javascript的error呢?
delete flag offensive retag edit

5 Replies

Sort by » oldest newest

answered 2007-06-08 04:55:11 +0800

jumperchen gravatar image jumperchen
3909 2 8
http://jumperchen.blogspo... ZK Team
zscript都是跑在Server side的,所以如果你要用Javascript去執行你的function,你要用<script type="text/javascript"/>去寫你的Javascript function.

/Jumper
link publish delete flag offensive edit

answered 2007-07-09 21:47:51 +0800

free99 gravatar image free99
6
不要聽他虎爛
只是你寫錯語法而已
<window title="My First Window" border="normal" width="200px">
Hello, World!
<zscript language="javascript">
function test(){
alert("This is my test code.");
}
</zscript>
<button label="Test" onClick="javascript:test()"/>
</window>

降不就會動ㄌ
link publish delete flag offensive edit

answered 2007-07-10 06:42:57 +0800

atticcat gravatar image atticcat
192

updated 2007-07-10 06:44:17 +0800

Hi,

Jumper講的並沒有錯~
zscript確實是跑在server side,而你指定的language可以是javascript,也可以是ruby or groovy,但是這些都是跑在server side~
至於為什麼可以呼叫alert是因為alert是ZK在server端作的一個轉呼叫Messagebox.show的function.
而tommy1973所問的問題,在action要呼叫的javascript,(詳見develop guide)卻必需是要在client端的javascript才行..

/Dennis.
link publish delete flag offensive edit

answered 2007-07-10 10:33:10 +0800

free99 gravatar image free99
6
好ㄅ~~ 我輸ㄌ~~嗚嗚~~~
我想你們的意思是降

<window title="My First Window" border="normal" width="200px">
Hello, World!
<script type="text/javascript">
function test(){
alert("This is my test code.");
}
</script>
<button label="Test" action="onclick:test()"/>
</window>
link publish delete flag offensive edit

answered 2007-07-22 02:42:53 +0800

xieshujian gravatar image xieshujian
6
谢谢 又学了一招
link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2007-06-08 03:55:38 +0800

Seen: 1,173 times

Last updated: Jul 22 '07

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More