惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V2EX - 技术
V2EX - 技术
阮一峰的网络日志
阮一峰的网络日志
博客园 - 叶小钗
月光博客
月光博客
人人都是产品经理
人人都是产品经理
美团技术团队
J
Java Code Geeks
博客园 - 聂微东
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
罗磊的独立博客
博客园 - 【当耐特】
GbyAI
GbyAI
P
Proofpoint News Feed
T
The Exploit Database - CXSecurity.com
D
Docker
Vercel News
Vercel News
小众软件
小众软件
NISL@THU
NISL@THU
Simon Willison's Weblog
Simon Willison's Weblog
雷峰网
雷峰网
Spread Privacy
Spread Privacy
T
Threatpost
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Palo Alto Networks Blog
爱范儿
爱范儿
L
LINUX DO - 热门话题
博客园_首页
I
Intezer
博客园 - Franky
Security Latest
Security Latest
Scott Helme
Scott Helme
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
Schneier on Security
O
OpenAI News
WordPress大学
WordPress大学
TaoSecurity Blog
TaoSecurity Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
G
Google Developers Blog
M
MIT News - Artificial intelligence
The Register - Security
The Register - Security
Cisco Talos Blog
Cisco Talos Blog
Forbes - Security
Forbes - Security
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tenable Blog
SecWiki News
SecWiki News
酷 壳 – CoolShell
酷 壳 – CoolShell
C
Cyber Attacks, Cyber Crime and Cyber Security
N
News | PayPal Newsroom
量子位
博客园 - 三生石上(FineUI控件)

博客园 - X龙

远程唤醒wol(Wake On Lan) 我的附件列表 github项目管理 js提交验证 web模拟慢网速环境 js 格式化日期 div+css搭建系统页面框架 Win7下如何在任务栏显示操作中心的图标 清除右键图形属性 图形选项 .net软件工程师面试知识点 设置JqueryUI DatePicker默认语言为中文 asp.net mvc2升级到asp.net mvc3 pivot与unpivot用法 解决32位ie不能上网,64位ie能上网 seo robots.txt编写 xml xmlnamespace sql server 2005生成insert语句,同时完成多表(Bug:插入语句列列表最后一列列名后还带有,) input type=file显示及清空值 预防SQL注入攻击
按钮提交事件处理(以下方法兼容ie,firefox,chrome)
X龙 · 2012-07-28 · via 博客园 - X龙

1. input[type="button"],input[type="button"]
前提函数:function myfunction(e){};
当点击按钮需要验证,并控件表单是否提交时,使用onclick="myfunction(event);",
使用event的原因:是为了兼容firefox,firefox会生成function click(event){myfunction(event);},
如果你写成onclick="myfunction(e);",firefox中会生成function click(event){myfunction(e);},e没有定义所以会出错。
2.一个按钮绑定多个事件处理程序时,需要根据上一个事件处理程序是否通过验证的结果时,在myfunction中设置
function myfunction(e){if(通过验证){e.returnValue = true};else{e.returnValue = false;}},在第二个事件处理程序中可以通过e.returnValue来判断上一个事件处理程序是否通过验证。说明:firefox的event中不存在returnValue,不存在时为它赋值,会创建该属性。