shirly521 发表于 2013-2-7 17:27:20

生活+学习=笔记

Onclick 也可以这样用呀
 
问题:
页面中onclick函数,点击a链接时触发两个事件,第一用confirm判断用户是否确认执行该操作,在根据结果调用Ajax请求。就在html页面里,你说该怎写?
 
do_shutdown_computer" namespace="/account/ajax" includeParams="none"><@s.param name="computerId" value="${computerId}" /></@s.url>', {asynchronous:true, evalScripts:true, method:'get'}); return false;"怎么再给这个onclick事件加上congfirm来判断?
----------------------------------------
解决:
 
onclick 也可以这样用呀:
<a  class="admin toggle show_hide_toggler_new_computer"  href="#"  onclick="if( confirm('确定要关闭远程计算机?')) new Ajax.Request('<@s.url action="do_shutdown_computer" namespace="/account/ajax" includeParams="none"><@s.param name="computerId" value="${computerId}" /></@s.url>', {asynchronous:true, evalScripts:true, method:'get'}); return false;">关闭远程计算机</a>
 
页: [1]
查看完整版本: 生活+学习=笔记