在asp.net 2.0生成的JS中
<script type="text/javascript">
<!--
var theForm = document.forms['Form1'];
if (!theForm) {
theForm = document.Form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
// -->
</script>
中比1.1版中多出下面的判断。
if (!theForm.onsubmit || (theForm.onsubmit() != false))
使得<form id="Form1" method="post" runat="server" name="Form1" onSubmit="return login_check() && checkDate1() && checkDate2();">
中自定义的验证函数每当触发器控件的AutoPastBack时都要验证一回。
感觉很不爽。
原来在asp.net 1.1 下就很OK。。
请教要怎么修改来适应asp.net 2.0以达到和1.1时一样的效果。 请教各位后得出结果:
string strJs = "";
strJs += "var theForm = document.forms['Form1'];\n";
strJs += "if (!theForm) {\n";
strJs += "theForm = document.Form1;\n";
strJs += "}\n";
strJs += "__doPostBack = function(eventTarget, eventArgument)\n";
strJs += "{\n";
strJs += " theForm.__EVENTTARGET.value = eventTarget;\n";
strJs += "theForm.__EVENTARGUMENT.value = eventArgument;\n";
strJs += "theForm.submit();\n";
strJs += "}\n";
输入上面的js
但是新问题又出现了
页面原来用的验证控件又不起作用了,能"提示"但是不能"阻止"提交,
怎么才能让js的onSubmit="return login_check() && checkDate1() && checkDate2();">
和页面的验证控件共存,并起到各自的作用
<script type="text/javascript">
<!--
var theForm = document.forms['Form1'];
if (!theForm) {
theForm = document.Form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
// -->
</script>
中比1.1版中多出下面的判断。
if (!theForm.onsubmit || (theForm.onsubmit() != false))
使得<form id="Form1" method="post" runat="server" name="Form1" onSubmit="return login_check() && checkDate1() && checkDate2();">
中自定义的验证函数每当触发器控件的AutoPastBack时都要验证一回。
感觉很不爽。
原来在asp.net 1.1 下就很OK。。
请教要怎么修改来适应asp.net 2.0以达到和1.1时一样的效果。 请教各位后得出结果:
string strJs = "";
strJs += "var theForm = document.forms['Form1'];\n";
strJs += "if (!theForm) {\n";
strJs += "theForm = document.Form1;\n";
strJs += "}\n";
strJs += "__doPostBack = function(eventTarget, eventArgument)\n";
strJs += "{\n";
strJs += " theForm.__EVENTTARGET.value = eventTarget;\n";
strJs += "theForm.__EVENTARGUMENT.value = eventArgument;\n";
strJs += "theForm.submit();\n";
strJs += "}\n";
输入上面的js
但是新问题又出现了
页面原来用的验证控件又不起作用了,能"提示"但是不能"阻止"提交,
怎么才能让js的onSubmit="return login_check() && checkDate1() && checkDate2();">
和页面的验证控件共存,并起到各自的作用
和页面的验证控件共存,并起到各自的作用
和页面的验证控件共存,并起到各自的作用