这一段代码百思不得其解?大侠帮忙看看
如果没有把onSubmit="return isok()"去掉,在后台接收时,description表单值为空。去掉后能正常接受到这个表单的内容。但不能在前台验证其是否为空。到底是为什么?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>上传照片</title>
<link href="style.css" rel="stylesheet" type="text/css">
<script language="JavaScript">
function isok(){
document.photo_file.submit.disabled=true;
if(document.photo_file.photo_file.value==""){
document.photo_file.submit.disabled=false;
alert("难道你不想上传照片吗?");
return false;
}
if(document.photo_file.description.value==""){
document.photo_file.submit.disabled=false;
alert("别忘了给照片一些说明哦!");
return false;
}
return true;
}
</script>
</head>
<body>
<table width="296" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="296" height="30" class="top2" align="center" valign="middle">上传照片</td>
</tr>
<tr>
<td height="16"> </td>
</tr>
<tr>
<td height="135" valign="top"><form action="r_photo.asp" method="post" enctype="multipart/form-data" name="photo_file" onSubmit="return isok()">
照片:
<input type="file" name="photo_file">
<br>
类型:
<select name="type" id="type">
<option value="个人照片">个人照片</option>
<option value="校园风景">校园风景</option>
<option value="其他杂项">其他杂项</option>
</select>
<br>
介绍:<br>
<textarea name="description" cols="40" rows="5" id="description"></textarea>
<br>
<div align="center"><input type="submit" name="Submit" id="submit" value="OK!上传我的照片"></div>
<br>
</form></td>
</tr>
</table>
</body>
</html>