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

推荐订阅源

D
Docker
爱范儿
爱范儿
T
The Exploit Database - CXSecurity.com
量子位
T
Tailwind CSS Blog
T
Threatpost
The GitHub Blog
The GitHub Blog
AWS News Blog
AWS News Blog
云风的 BLOG
云风的 BLOG
K
Kaspersky official blog
P
Proofpoint News Feed
博客园 - 司徒正美
L
LangChain Blog
T
Threat Research - Cisco Blogs
C
CERT Recently Published Vulnerability Notes
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 叶小钗
S
Secure Thoughts
The Last Watchdog
The Last Watchdog
Spread Privacy
Spread Privacy
H
Hacker News: Front Page
T
Troy Hunt's Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
W
WeLiveSecurity
A
Arctic Wolf
Apple Machine Learning Research
Apple Machine Learning Research
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
P
Proofpoint News Feed
T
Tor Project blog
T
The Blog of Author Tim Ferriss
I
Intezer
P
Privacy & Cybersecurity Law Blog
美团技术团队
N
Netflix TechBlog - Medium
博客园_首页
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Vulnerabilities – Threatpost
Application and Cybersecurity Blog
Application and Cybersecurity Blog
G
Google Developers Blog
Attack and Defense Labs
Attack and Defense Labs
T
Tenable Blog
月光博客
月光博客
Stack Overflow Blog
Stack Overflow Blog
J
Java Code Geeks
腾讯CDC
Microsoft Security Blog
Microsoft Security Blog
A
About on SuperTechFans
Last Week in AI
Last Week in AI

博客园 - zeus2

Xfire的初次使用 SQl Server 2012正式版发布 单例模式的三种实现方法 Oracle常用Hint Oracle 设计海量数据库 读书笔记(三) Oracle 设计海量数据库 读书笔记(二) Oracle 设计海量数据库 读书笔记(一) 解决中文ID3标签乱码zz 系统架构性能提高方案! 使用开源工具架设开发平台 修改SQL Server数据库地址 System.DateTimeOffset Load的问题 当应用程序发布到iis7/iis7.5出现需要使用经典模式时 - zeus2 - 博客园 [读书笔记]SQL技术内幕Identity XML序列化封装 根据实体类生成查询安全版 生活太艰难了。!!! 从底层角度看ASP.NET-A low-level Look at the ASP.NET Architecture(转载) C++访问Sqlite数据库(存档) - zeus2 - 博客园
关于__doPostBack之前截获调用 - zeus2 - 博客园
zeus2 · 2009-11-24 · via 博客园 - zeus2

小弟最近要实现一个功能,就是如果改页面被修改,则不能翻页,必须提交本页后才能翻页。

js代码
if ($("#hdnFromSubmit").val() == "1") {
                
return true;
            }
            
else {
                
if ($("#hdnChanged").val() == "1") {
                    alert(
"当前页报价已修改,必须提交本页报价后才能点击翻页。");
                    
return false;
                }
                
else {
                    
return true;
                }
            }

需要把该功能加载到form的onsubmit事件。

经过检测发现很有意思的事。

如果使用$("form").submit函数加载这段代码,会发现_doPostBack回发的提交无法触发该事件。

经查是由于自动生成的__doPostBack函数,首先把当前form复制为theForm,然后在form1中加载的js代码就变得无效。

解决方案:

在自动生成_doPostBack函数前将form1的onsubmit修改好。

aspnetform
aspnetForm.onsubmit = function() {
            
if ($("#hdnFromSubmit").val() == "1") {
                
return true;
            }
            
else {
                
if ($("#hdnChanged").val() == "1") {
                    alert(
"当前页报价已修改,必须提交本页报价后才能点击翻页。");
                    
return false;
                }
                
else {
                    
return true;
                }
            }
        };