【发布时间】:2013-05-06 00:32:12
【问题描述】:
所以我想要的是在表单中使用 1 个按钮(因为 ajax 需要在表单中?) 到
1) 调用一个javascript函数,它基本上只是做一些动画(如淡出和淡入)
2) 调用更新“信息”表的 ajax 函数
所以基本上我想要的只是单击一个按钮,例如“开始” 然后 javascript 做了一些客户端的事情,比如在对象周围移动,ajax 给我关于存储在服务器上的那些对象的信息。..
我们的东西是这样的:
<h:panelGroup layout="block" id="player" class="player">
<h2 class="accessibility">Würfelbereich</h2>
<span class="accessibility">An der Reihe ist</span><div id="currentPlayerName"><h:outputText value=" #{spiel.getSpieler_Name()}" /></div>
<h:commandButton id="dice" alt="Würfel" image="resources/img/wuerfel0.png" action="#{spiel.dice()}" tabindex="4" title="Würfel">
<f:ajax render=":gameinfo" onevent="animate" />
</h:commandButton>
</h:panelGroup>
因此 gameinfo 是从服务器检索并使用 ajax 调用的信息表
并且 animate 是我们的 javascript 函数,它执行动画..
这里的问题是,一旦我们将 ajaax 命令放入表单标签中,animate 就不起作用了
【问题讨论】:
-
animate 函数是立即返回还是等到 10 秒动画完成?
标签: javascript html ajax jsf xhtml