监听器停止执行 [英] Listener that stops execution

查看:83
本文介绍了监听器停止执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我在页面上有一个ASP.NET按钮时,如果某些客户端检查失败,我不想将其发回服务器,我只需要按下JavaScript按钮即可。 event return false:

Whenever I have an ASP.NET button on a page that I don''t want to post back to the server if some client side check has failed I simply have the button''s JavaScript "onclick" event return false:

展开 | 选择 | Wrap | 行号

推荐答案

@Frinavale


我也想知道这一点(已经尝试了几天,但到目前为止没有成功)


如果那条路线失败我只能想象一下仅限Javascript路由,删除提交按钮并在验证成功时执行form.submit()。


note:根据DTD,< input>是一个空元素(如果验证很重要)
@Frinavale
I''d like to know that too (trying already some days on that, but no success so far)

If that route fails I can only imagine a Javascript only route that removes the submit button and does a form.submit() on validation success.

note: as per DTD, <input> is an empty element (if validation matters)


起初我认为我可以通过指定我正在处理事件来做到这一点....(从这里得到了想法但是在阅读这篇文章)我认为你必须指明你正在处理事件和阻止事件冒泡回来。


例如:
At first I thought that I might be able to do this by specifying that I''m handling the event....(got the idea from here but realized where I was going wrong after reading this article) I thought that you have to specify that you are handling the event and stop the event from being bubbled back up.

For example:
< span class =codeLinkonclick =Blur(this,this.parentNode.parentNode,getChildren(this),true);>展开 | 选择 | Wrap | < span class =codeLinkonclick =LineNumbers(this);>行号


我非常难以忍受:(

关于下一步研究的内容我已经用完了......
I''m so incredibly stuck :(
I have run out of ideas on what to research next....


这篇关于监听器停止执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆