<script language="javascript" type="text/javascript">
function checkform(inputForm)
{
if (document.getElementById("id").value == "")
{
alert("请填写编号");
return false;
}}</script>
<form id="form1" name="form1" method="post" action="<?php echo $PHP_SELF?>">
<table width="284" border="1">
<tr>
<td width="73">编号</td>
<td width="195"><input type="text" name="id" id="id" value="" action="<?php echo $id?>" /></td>
</tr>
<tr>
</table>
<label><br />
<input type="submit" name="Submit" value="提交" action="<?php echo $submit?>" />
<br />
<br />
</label>
<p>
<label></label>
</p>
</form>请问为什么不能触发判断呢?按了按钮后,没有任何反应。
function checkform(inputForm)
{
if (document.getElementById("id").value == "")
{
alert("请填写编号");
return false;
}}</script>
<form id="form1" name="form1" method="post" action="<?php echo $PHP_SELF?>">
<table width="284" border="1">
<tr>
<td width="73">编号</td>
<td width="195"><input type="text" name="id" id="id" value="" action="<?php echo $id?>" /></td>
</tr>
<tr>
</table>
<label><br />
<input type="submit" name="Submit" value="提交" action="<?php echo $submit?>" />
<br />
<br />
</label>
<p>
<label></label>
</p>
</form>请问为什么不能触发判断呢?按了按钮后,没有任何反应。
在input里面添加onclick时间。。你之前都没有调用那个函数,当然没反应
function checkform(f){
if (document.getElementById("id").value == ""){ alert("请填写编号"); return false;}
f.submit();
}
</script>
<form id="form1" name="form1" method="post" action="" onsubmit="return checkform(this)">
<table width="284" border="1">
<tr>
<td width="73">编号</td>
<td width="195"><input type="text" name="id" id="id" /></td>
</tr>
<tr>
</table>
<label><br />
<input type="submit" name="Submit" value="提交" />
<br />
<br />
</label>
<p>
<label></label>
</p>
</form>
<form id="form1" name="form1" method="post" action="<?php echo $PHP_SELF?>" onsubmit="return checkform('form1')">
<?php echo $PHP_SELF; ?>
<form onSubmit="return checkform(this);" ...