|
 |
|
ผมทำการตรวจสอบการใส่ข้อมูล แต่มันทำไม่ได้ ดูให้หน่อยว่าผิดบรรทัดใหนครับ |
|
 |
|
|
 |
 |
|
Code (PHP)
<script type="text/javascript">
function IsCheck(txtName, txtAddress, txtPhone, txtFax, txtEmail, txtWeb, txtConnect, txtPosition, txtCredit)
{
//alert(eText);
if(document.getElementById(txtName).value == ''
&& document.getElementById(txtAddress).value == ''
&& document.getElementById(txtPhone).value == ''
&& document.getElementById(txtFax).value == ''
&& document.getElementById(txtEmail).value == ''
&& document.getElementById(txtWeb).value == ''
&& document.getElementById(txtConnect).value == ''
&& document.getElementById(txtPosition).value == ''
&& document.getElementById(txtCredit).value == ''
)
{
alert('กรุณาใส่ข้อมูล');
return false;
}
else if(document.getElementById(txtName).value == ''
|| document.getElementById(txtAddress).value == ''
|| document.getElementById(txtPhone).value == ''
|| document.getElementById(txtFax).value == ''
|| document.getElementById(txtEmail).value == ''
|| document.getElementById(txtWeb).value == ''
|| document.getElementById(txtConnect).value == ''
|| document.getElementById(txtPosition).value == ''
|| document.getElementById(txtCredit).value == ''
)
{
alert('กรุณาใส่ข้อมูลให้ครบ');
return false;
}
var txtPhoneFilter=/^([0-9]){1,}$/;
var txtPhone=document.form1.txtPhone.value;
if (!(txtPhoneFilter.test(txtPhone)))
{
alert ("เบอร์โทรศัพท์ต้องป็นตัวเลข");
return false;
}
var txtFaxFilter=/^([0-9]){1,}$/;
var txtFax=document.form1.txtFax.value;
if (!(txtFaxFilter.test(txtFax)))
{
alert ("เบอร์โทรสารต้องป็นตัวเลข");
return false;
}
var txtCreditFilter=/^([0-9]){1,}$/;
var txtCredit=document.form1.txtCredit.value;
if (!(txtCreditFilter.test(txtCredit)))
{
alert ("ปล่อยเครดิตต้องป็นตัวเลข");
return false;
}
var txtEmailFilter=/^.+@.+\..{2,3}$/;
var txtEmail=document.form1.txtEmail.value;
if (!(txtEmailFilter.test(txtEmail)))
{
alert ("อีเมล์ไม่ถูกต้อง");
return false;
}
else
return true;
}
</script>
Code (PHP)
<label>
<input input type="submit" name="btnSubmit" onclick= "return IsCheck('txtName','txtAddress','txtPhone','txtFax','txtEmail','txtWeb','txtConnect','txtPosition','txtCredit');" value="ตกลง" style="width:100px" />
</label>
Tag : PHP

|
|
 |
 |
 |
 |
Date :
2011-09-20 14:44:46 |
By :
tangsupap |
View :
683 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
มันน่าจะมี Error เหลือง ๆ ตรง Status bar ของ IE ครับ
|
 |
 |
 |
 |
Date :
2011-09-20 22:37:36 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใช้ firebug หรือ error console ของ firefox ช่วยครับ เห็นเลยว่า error ที่ไหน
|
 |
 |
 |
 |
Date :
2011-09-20 23:33:21 |
By :
ikikkok |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|