ช่วย check ค่าว่าง เปน javascript จาก code นี้หน่อยค่ะ

ช่วยด้วยค่ะ
สมมติถ้าเราไม่ได้เลือก checkbox แล้วเรากด submit ไปให้มานแจ้ง error ตรง javascript ว่าให้ทำการเลือก checkbox ด้วยค่ะ
<script language="javascript">
function checkAllBox(obj)
{
  var theForm = obj.form;
  var i;
  if(obj.checked){
   for(i=1;i<theForm.length; i++)
   {
     theForm[i].checked = true;
   }
  }else if(!obj.checked){
   for(i=1;i<theForm.length; i++)
   {
     theForm[i].checked = false;
   }
  }
}
</script>

<script type="text/javascript">
function send1(frm) {
  frm.action = "testpage1.php" //ส่งไป page1
  frm.submit()
}
function send2(frm) {
  frm.action = "testpage2.php" //ส่งไป page2
  frm.submit()
}
</script>

<body>
<form id="form1" onSubmit="return check(this)" name="form1" method="post" >
<input type="checkbox" name="checkall" onclick="checkAllBox(this)" />
<input type="checkbox" name="chk_email[]" value="1"/>
<input type="checkbox" name="chk_email[]" value="2"/>

 <input type="button" value="Send 1" onclick="send1(form1)" />
<input type="button" value="Send 2" onclick="send2(form1)" />

</form>

23 ส.ค. 2552 1 3,521

ผมเขียนตัวอย่างไว้ให้แล้ว ลองประยุกต์ดูนะครับ

สำหรับกรณีด้านบนอาจต้องประยุกต์ใช้ กรณีนี้ร่วมด้วย http://www.goragod.com/...A2....html
#1
ความคิดเห็น
ไฟล์อัปโหลด ชนิด jpg, jpeg ขนาดไฟล์ไม่เกิน 1024
^