本文介绍了监听器停止执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
每当我在页面上有一个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: 展开 | 选择 | Wrap | 行号
我非常难以忍受:( 关于下一步研究的内容我已经用完了...... I''m so incredibly stuck :( I have run out of ideas on what to research next....
更多推荐
监听器停止执行
发布评论