javascript - 带有 Javascript 提交的 Html 表单有时不记录信息
问题描述
因此,我编写了一个小表格,以便更轻松地记录客户的信息。我现在没有把它连接到分贝,它只是在屏幕上重新打印客户信息。出于某种原因,如果它在浏览器中停留的时间过长,点击提交按钮后,信息就会消失并且不会重新打印到屏幕上。提交时输入的信息仍然显示在 URL 栏中,但我不确定为什么会这样。如果有人有修复,那就太棒了。我在下面附上了我的代码。
<!doctype html>
<html lang = "en">
<head>
<meta charset="utf-8" />
<title>ProFormer</title>
<link rel="stylesheet" href = "testing.css" />
<script>
function display(form){
form.o_name.value = form.name.value;
form.o_city.value = form.city.value;
form.o_state.value = form.state.value;
form.o_phone.value = form.phone.value;
form.o_email.value = form.email.value;
form.o_dob.value = form.dob.value;
form.o_gender.value = form.gender.value;
form.o_heightandweight.value = form.heightandweight.value;
form.o_tobacco.value = form.tobacco.value;
form.o_hc.value = form.hc.value;
form.o_baddiseases.value = form.baddiseases.value;
form.o_rx.value = form.rx.value;
form.o_pain.value = form.pain.value;
form.o_insuredstatus.value = form.insuredstatus.value;
form.o_premiumrange.value = form.premiumrange.value;
form.o_notes.value = form.notes.value;
return false;
}
</script>
</head>
<body>
<form name="input" action="" method="get" onsubmit="return display(this);">
<section>
<div class = "scrollWrapper">
<table>
<tr>
<th>NAME: </th>
<td><output name="o_name" style="width:100px; height:20px"></output></td>
</tr>
<tr>
<th>CITY: </th>
<td><output name="o_city" style="width:100px; height:20px"></output></td>
</tr>
<tr>
<th>STATE: </th>
<td><output name="o_state" style="width:100px; height:20px"></output></td>
</tr>
<tr>
<th>PHONE: </th>
<td><output name="o_phone" style="width:100px; height:20px"></output></td>
</tr>
<tr>
<th>EMAIL: </th>
<td><output name="o_email" style="width:100px; height:20px"></output></td>
</tr>
<tr>
<th>DOB: </th>
<td><output name="o_dob" style="width:100px; height:20px"></output></td>
</tr>
<tr>
<th>GENDER: </th>
<td><output name="o_gender" style="width:100px; height:20px"></output></td>
</tr>
<tr>
<th>HEIGHT AND WEIGHT: </th>
<td><output name="o_heightandweight" style="width:100px; height:20px"></output></td>
</tr>
<tr>
<th>TOBACCO: </th>
<td><output name="o_tobacco" style="width:100px; height:20px"></output></td>
</tr>
<tr>
<th>HC: </th>
<td><output name="o_hc" style="width:100px; height:20px"></output></td>
</tr>
<tr>
<th>STROKE, HA, CANCER, COPD, HIV: </th>
<td><output name="o_baddiseases" style="width:100px; height:20px"></output></td>
</tr>
<tr>
<th>Rx: </th>
<td><output name="o_rx" style="width:100px; height:20px"></output></td>
</tr>
<tr>
<th>PAIN: </th>
<td><output name="o_pain" style="width:100px; height:20px"></output></td>
</tr>
<tr>
<th>INSURED STATUS: </th>
<td><output name="o_insuredstatus" style="width:100px; height:20px"></output></td>
</tr>
<tr>
<th>AFFORDABLE RANGE OF PREMIUM: </th>
<td><output name="o_premiumrange" style="width:100px; height:20px"></output></td>
</tr>
<tr>
<th>NOTES: </th>
<td><output name="o_notes" style="width:100px; height:20px"></output></td>
</tr>
</table>
</div>
</section>
<section id = "sec2">
<p>Name:</p><input type="text" name="name"><br>
<p>City:</p><input type="text" name="city"><br>
<p>State:</p><input type="text" name="state"><br>
<p>Phone:</p> <input type="text" name="phone"><br>
<p>Email:</p> <input type="text" name="email"><br>
<p>Date of Birth:</p> <input type="text" name="dob"><br>
<p>Gender:</p> <input type="text" name="gender"><br>
<p>Height and Weight:</p> <input type="text" name="heightandweight"><br>
<p>Tobacco:</p> <input type="text" name="tobacco"><br>
<p>Health Conditions:</p> <input type="text" name="hc"><br>
<p>Stroke, HA, Cancer, COPD, HIV:</p> <input type="text" name="baddiseases"><br>
<p>Rx:</p> <input type="text" name="rx"><br>
<p>Pain:</p> <input type="text" name="pain"><br>
<p>Insured Status:</p> <input type="text" name="insuredstatus"><br>
<p>Affordable Range of Premium:</p> <input type="text" name="premiumrange"><br>
<p>Notes:</p> <textarea type="text" name="notes" rows = "4" cols = "25"></textarea><br>
<br>
<input type="submit" value="Submit">
</section>
</form>
</body>
</html>
解决方案
推荐阅读
- javascript - 如何在 Vue 中保存表单提交时更改的道具数据?
- python - 无法导入相对于正在运行脚本的目录的模块
- javascript - 反应地图对象包含数组
- r - 有没有办法根据值自动生成组内不同的行组合?
- encryption - Asp.Net Core Jwt access_token 签名和加密
- ssas - 如何解决行级安全性能影响
- airflow - 覆盖气流中的雪花钩
- virtual-environment - 没有 Python 的 Mac 上的虚拟环境
- powershell - powershell:根据名称将文件复制到子目录
- javascript - 使用 Vue javascript 模块时导入