php网页中textarea input为空JS无法判断,求解决办法
<html><head><title>实验报告提交系统</title><scripttype="text/javascript">functionYanZheng(){v...
<html>
<head>
<title>实验报告提交系统</title>
<script type="text/javascript">
function YanZheng() {
var cname = document.getElementById("cname").value;
var tname = document.getElementById("tname").value;
var cpro = document.getElementById("cpro").value;
//这个功能没实现
if (cname =="")
{
window.alert("请输入所有内容");
return false;
}
}
</head>
<body>
<form name="form1"action="mtmn1.php" method="post" onsubmit="return YanZheng();">
<table width="500" align="center" cellpadding="0" height="20" >
<caption><h2>布置作业</h2></caption>
<tr>
<th style="text-align:left">课程名称:</th>
<td>
<input type="text" name="cname" id="cname" style="border-color:#FCC898;border-width:3px;border-style:solid;font-weight:normal;width:400px;">
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="提交">
<input type="reset" value="重置" onclick="Reset()">
</td>
</tr>
</table>
</form>
</body>
</html>
这是部分代码,求网友们找下哪边的问题,谢谢 展开
<head>
<title>实验报告提交系统</title>
<script type="text/javascript">
function YanZheng() {
var cname = document.getElementById("cname").value;
var tname = document.getElementById("tname").value;
var cpro = document.getElementById("cpro").value;
//这个功能没实现
if (cname =="")
{
window.alert("请输入所有内容");
return false;
}
}
</head>
<body>
<form name="form1"action="mtmn1.php" method="post" onsubmit="return YanZheng();">
<table width="500" align="center" cellpadding="0" height="20" >
<caption><h2>布置作业</h2></caption>
<tr>
<th style="text-align:left">课程名称:</th>
<td>
<input type="text" name="cname" id="cname" style="border-color:#FCC898;border-width:3px;border-style:solid;font-weight:normal;width:400px;">
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="提交">
<input type="reset" value="重置" onclick="Reset()">
</td>
</tr>
</table>
</form>
</body>
</html>
这是部分代码,求网友们找下哪边的问题,谢谢 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询