Iran58
جمعه 23 اسفند 1392, 22:59 عصر
سلام
من صفحه زیر را نوشته ام اما در اجرا خطا زیر را برای من می گیرد نمی دانم مشکل از کجاست لطفا راهنمای بفرمایید
Message: 'document.getElementById(...)' is null or not an object
Line: 15
Char: 4
Code: 0
URI: http://localhost:8084/student/new.php
<!DOCTYPE HTML><html><head><meta charset="utf-8"><title>new</title><script language="javascript"> function checkedform(){ var n=document.getElementById("txFirstName").value; var f=document.getElementById("tfLastName").value; var y=document.getElementById("tfYear").value; if((n=="")||(f=="")||(y=="")){ alert("fill form ..."); } else{ document.getElementById("form1").submit(); } }</script></head>
<body><form name="form1" method="post" action="Save.php"> <p align="center"><strong>Registration Form</strong></p> <table width="300" border="1" align="center" cellpadding="5"> <tr> <td>FirstName:</td> <td><input type="text" name="txFirstName" id="txFirstName"></td> </tr> <tr> <td>LastName:</td> <td><input type="text" name="tfLastName" id="tfLastName"></td> </tr> <tr> <td>Year:</td> <td><input type="text" name="tfYear" id="tfYear"></td> </tr> <tr> <td>Address:</td> <td><label for="tfAddress"></label> <textarea name="tfAddress" id="tfAddress"></textarea></td> </tr> <tr> <td> </td> <td><input type="button" name="btnOk" onClick="checkedform();" id="btnOk" value="Ok" > <input type="button" name="btnBack" id="btnBack" value="Back"></td> </tr> </table></form></body></html>
من صفحه زیر را نوشته ام اما در اجرا خطا زیر را برای من می گیرد نمی دانم مشکل از کجاست لطفا راهنمای بفرمایید
Message: 'document.getElementById(...)' is null or not an object
Line: 15
Char: 4
Code: 0
URI: http://localhost:8084/student/new.php
<!DOCTYPE HTML><html><head><meta charset="utf-8"><title>new</title><script language="javascript"> function checkedform(){ var n=document.getElementById("txFirstName").value; var f=document.getElementById("tfLastName").value; var y=document.getElementById("tfYear").value; if((n=="")||(f=="")||(y=="")){ alert("fill form ..."); } else{ document.getElementById("form1").submit(); } }</script></head>
<body><form name="form1" method="post" action="Save.php"> <p align="center"><strong>Registration Form</strong></p> <table width="300" border="1" align="center" cellpadding="5"> <tr> <td>FirstName:</td> <td><input type="text" name="txFirstName" id="txFirstName"></td> </tr> <tr> <td>LastName:</td> <td><input type="text" name="tfLastName" id="tfLastName"></td> </tr> <tr> <td>Year:</td> <td><input type="text" name="tfYear" id="tfYear"></td> </tr> <tr> <td>Address:</td> <td><label for="tfAddress"></label> <textarea name="tfAddress" id="tfAddress"></textarea></td> </tr> <tr> <td> </td> <td><input type="button" name="btnOk" onClick="checkedform();" id="btnOk" value="Ok" > <input type="button" name="btnBack" id="btnBack" value="Back"></td> </tr> </table></form></body></html>