所以我有一个表格,当填写表格并按下提交时,我希望表格被“隐藏”起来并出现一些图像。
但是,我目前被困在“隐藏”表单上,因为在用户按下页面上的后退按钮(而不是浏览器上)后,我需要表单再次出现,而且我还需要将表单上的值提前按下提交后到该页面。
形式:
<form id = "step1" onsubmit = "return formcheck()">
<p>
Creator:
<select name="creator" id = "creator">
<option></option>
<option name = "abc" value = "nba">nba</option>
<option name = "abc" value = "abc"> oiasfn</option>
</select>
</p>
<p>
Trip Title:
<select name="title" id = "title">
<option></option>
<option value = "cba">cbz</option>
</select>
</p>
<p>
Device:
<select name="device" id = "device">
<option name = "SN" value = "SN">Samsung Note</option>
<option name = "abc" value = "abc"> oiasfn</option>
</select>
</p>
<p>
No. of devices:
<select id = "deviceno" name = "deviceno">
<option></option>
<option value = "1">1</option>
</select>
</p>
<p>
<input type="submit" name="next" id="next" value="Next"></input>
</p>
</form>
javascript函数表单检查():
function formcheck()
{
var Ccreator = document.getElementById('creator').value;
var Ctitle = document.getElementById('title').value;
var Cdevice = document.getElementById('device').value;
var Cdeviceno = document.getElementById('deviceno').value;
if(Ccreator == ""||Ctitle == ""||Cdevice == ""||Cdeviceno == "")
{
alert("Form incomplete!");
return false;
}
else
{
$("#step1").hide();
return true;
}
}