为什么 form.reset() 在此页面上回发后不起作用? [英] How come form.reset() doesn't work after postback on this page?
本文介绍了为什么 form.reset() 在此页面上回发后不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我班上的一个学生让我注意到了这一点,但我没有解释——而且我在搜索后找不到.
点击提交按钮后,重置按钮不起作用.如果资源是通过 post 请求请求的,就好像浏览器会阻止重置.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="服务器"><title></title>头部><身体><form id="form1" runat="server"><div><字段集><legend>用户表单</legend><label for="用户名"></label><asp:TextBox ID="用户名" runat="服务器"></asp:TextBox></fieldset><asp:Button runat="server" Text="Submit"/><input type="button" onclick="window.document.forms[0].reset()" value="reset"/>
</表单>