پیام حیاتی
جمعه 27 فروردین 1395, 09:43 صبح
سلام
قسمت else برقرار نمی شود:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Validation Form with JS</title>
<script language="javascript">
function check()
{
a=document.getElementById("txtName").value;
if((a==""))
{
alert("Fill All");
}
else
form1.submit();
}
</script>
</head>
<body>
<form name="form1" id="form1" action="save.php" method="post" >
Home: <input type="text" name="txtName" id="txtName" />
<input type="button" onClick="check();" name="submit" value="save" />
</form>
</body>
</html>
140023
قسمت else برقرار نمی شود:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Validation Form with JS</title>
<script language="javascript">
function check()
{
a=document.getElementById("txtName").value;
if((a==""))
{
alert("Fill All");
}
else
form1.submit();
}
</script>
</head>
<body>
<form name="form1" id="form1" action="save.php" method="post" >
Home: <input type="text" name="txtName" id="txtName" />
<input type="button" onClick="check();" name="submit" value="save" />
</form>
</body>
</html>
140023