奇怪,为什么给form以及form内的所有表单命名会全部无效?
比如我在页面内写上
<form method= "post " name= "form1 " id= "form1 " enctype= "multipart/form-data " onSubmit= "return validate(this); " runat= "server ">
<asp:TextBox id=Title CssClass= "colorblur " Width= "420px " Height= "20px " runat= "server " onFocus= "this.className= 'colorfocus '; " onBlur= "this.className= 'colorblur '; " MaxLength= "60 " title= "标题最多为60个字符 "/>
</form>
运行之后,静态页面所显示的结果是
<form name= "__aspnetForm " method= "post " action= "Post.aspx " language= "javascript " onsubmit= "if (!ValidatorOnSubmit()) return false;return validate(this); " id= "__aspnetForm " enctype= "multipart/form-data " __smartNavEnabled= "true ">
<input name= "_ctl0:Title " type= "text " maxlength= "60 " id= "_ctl0_Title " class= "colorblur " onFocus= "this.className= 'colorfocus '; " onBlur= "this.className= 'colorblur '; " title= "标题最多为60个字符 " style= "height:20px;width:420px; " />
</form>
运行之后为什么我所指定的name不是原来指定的form1而成了__aspnetForm?有没有谁也碰到过类似的情况?现在要使用js在客户端对数据进行验证都不行,哎~
------解决方案--------------------帮LZ顶
------解决方案--------------------__aspnetForm 是在客户端,运行在服务器上的控件都有两个ID,一个是服务器的一个是客户端的,var myform = document.getElementById( "formid "); formid 为Form的ID
------解决方案--------------------正常情况下不会是这样子的,
你是不是把form放在一个用户控件里面了。如果是那就是正常的了。