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

推荐订阅源

AI
AI
TaoSecurity Blog
TaoSecurity Blog
H
Heimdal Security Blog
Help Net Security
Help Net Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Microsoft Azure Blog
Microsoft Azure Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Google DeepMind News
Google DeepMind News
爱范儿
爱范儿
The Cloudflare Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
人人都是产品经理
人人都是产品经理
大猫的无限游戏
大猫的无限游戏
N
News | PayPal Newsroom
V2EX - 技术
V2EX - 技术
博客园 - 【当耐特】
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
Secure Thoughts
C
CERT Recently Published Vulnerability Notes
罗磊的独立博客
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Privacy & Cybersecurity Law Blog
有赞技术团队
有赞技术团队
S
Schneier on Security
S
SegmentFault 最新的问题
Google Online Security Blog
Google Online Security Blog
H
Hacker News: Front Page
The Last Watchdog
The Last Watchdog
Schneier on Security
Schneier on Security
PCI Perspectives
PCI Perspectives
IT之家
IT之家
Project Zero
Project Zero
博客园 - 司徒正美
P
Privacy International News Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Jina AI
Jina AI
Security Latest
Security Latest
Hacker News - Newest:
Hacker News - Newest: "LLM"
腾讯CDC
C
CXSECURITY Database RSS Feed - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
C
Check Point Blog
aimingoo的专栏
aimingoo的专栏
V
Vulnerabilities – Threatpost
W
WeLiveSecurity
NISL@THU
NISL@THU
Webroot Blog
Webroot Blog
N
Netflix TechBlog - Medium
L
Lohrmann on Cybersecurity

博客园 - phcis

c# 全角(SBC)和半角(DBC)相互转换函数 用HttpWebRequest做POST请求时返回Http 417 错误解决方法 使用webbroswer的一点技巧记录 计算字符串相似度及寻找最相似字符串的代码 【转】DIV+CSS 让文字居中于背景图 sql 语句实现分页 【转】C#产生随机字符的两段代码 【转】datagridview的checkbox列,当修改checkbox状态时实时获得其准确状态值 c# 读取excel的一系列问题 - phcis - 博客园 由于使用“优易U盘加密软件”导致电脑无法关机/蓝屏等解决方法 批量删除数据库中所有表的记录(清空数据库) C# HttpRequest基础连接已经关闭: 接收时发生意外错误 GridView 动态绑定数据,包括2个或者多个值 - phcis - 博客园 近期动向 使用ajax导致滚动条复位的解决方法 AT编程常见问题与错误代码的意义 c# 发送email,正文支持html格式,包含附件 使用AutocompleteExtender无效或者没反应的原因记录 使用 DateTimePicker 控件显示和选择时间
asp.net中js返回false时阻止form提交的方法
phcis · 2011-06-01 · via 博客园 - phcis

起因:有一个服务器端的button,要在点击这个button后先验证表单数据,不符合规矩则给予alert,然后表单停止提交到服务器。

如js是:

    function checkData()
    {
     var item =$("input[name='radTransactType']:checked").val(); 
     if(item==null)
     {
       alert('请您至少选择一种报名方式!');
       return false;
     }   
     return true;   
    }

过程:

1.将调用此函数的代码写在了button的OnClientClick。发现提示是有了,可是表单依然提交

2.在OnClientClick写入 “return checkData();” 发现连alert都木有了。

3.直接将函数写在form的 onsubmit如:“ <form id="form1" runat="server" onsubmit="return checkData();">”。问题解决。

这下就只有当checkData函数返回true表单才提交到服务器了。