我班上的一位学生引起了我的注意,但我对此没有任何解释——而且在搜索后我也找不到任何解释。
点击提交按钮后,重置按钮不起作用。就好像如果通过 post 请求请求资源,浏览器会阻止重置。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<fieldset>
<legend>User Form</legend>
<label for="Username"></label>
<asp:TextBox ID="Username" runat="server"></asp:TextBox>
</fieldset>
<asp:Button runat="server" Text="Submit" />
<input type="button" onclick="window.document.forms[0].reset()" value="reset" />
</div>
</form>
</body>
</html>
单击重置后,条目将重置为默认值。默认值是服务器在第一种情况下呈现的值,它是空字符串,但在发布发布值之后。 (http 是无状态协议)如果您尝试编辑发布的值,然后单击重置,您将看到原始发布的值将被恢复。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)