我正在写一个表单验证脚本,并希望在onblur事件触发时验证给定的字段。 我也想使用事件冒泡,所以我不必为每个表单字段添加一个onblur事件。 不幸的是,onblur事件不会冒泡。 只是想知道是否有人知道可以产生相同效果的优雅解决方案。
I'm writing a form validation script and would like to validate a given field when its onblur event fires. I would also like to use event bubbling so i don't have to attach an onblur event to each individual form field. Unfortunately, the onblur event doesn't bubble. Just wondering if anyone knows of an elegant solution that can produce the same effect.
最满意答案
ppk有这方面的技术,包括IE的必要解决方法: http ://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
ppk has a technique for this, including the necessary workarounds for IE: http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
更多推荐
发布评论