function next()
{
alert("form submited");
return true;
}
<form onsubmit="return next()" action="add.php" method="post" id="p1">
<center>Add New Survey</center>
<p> </p>
<p align="left"> Title: </p>
<textarea name="title" cols="2" class="inputs" id="title"></textarea>
<p align="left"> Discription: (Optional) </p>
<textarea name="dis" cols="2" class="inputs" id="dis"></textarea>
<p align="left"> Number of questions: </p>
<select class="inputs" id="options" onchange="run()" name="options">
<option value="1" >1</option>
<option value="2" >2</option>
<option value="3" >3</option>
<option value="4" >4</option>
<option value="5" >5</option>
</select>
<br />
<input type="Submit" value="Next" class="button" name="next"/>
</p>
</form>
这是我的代码,我想通过JavaScript函数提醒“表单已提交”。当我提交表格时,没有任何反应。我应该警告字符串。