Loading...

JavaScript 檢查 Radio Button

Temperature: 0 °C

ChungChung
author_tools

要用 JavaScript 來檢查同一組的 radio button 是否已選,可用以下方法:


if ((theForm.radiobutton[0].checked==false)
&& (theForm.radiobutton[1].checked==false)
&&(theForm.radiobutton[2].checked==false)) {alert('此選項未選。');
return false;
}

也就是要將 radio button 視為陣列,來檢查它們 checked 是 true 或 false。
至於 checkbox 則是直接檢查 checkbox.checked,而在 PHP 裡則要直接讀出它的值,例如
$_REQUEST["checkbox"]

https://innstory.com/story-JavaScript_檢查_Radio_Button-140
寫程式筆記

Prev
 sql檔過大無法匯入phpMyAdmin

Next
SQL_Injection 

About the Author

Chung

我是chung
網路工作者
主業是網站系統開發建置
副業是做夢,寫故事
作品請參考/teme.biz
做夢請參考/innstory.com
聯絡/chung.teme@gmail.com

#有人用筆寫日記,有人用歲月寫日記,有人用照片寫日記,而我,用innstory寫日記。

Visitor message

Leave some footprints to prove that you visited me

Recommended reading

Author's other related stories

網站植入Facebook登入FB.api請求修改

網站植入Facebook登入...

會特別紀錄下來的原因是因為FB.api請求又調整了~ function fblogin() {//開...

PHP 利用phpmailer 寄信...

PHP 利用phpmaile...

一般來說其實PHP本身已經提供了Mail()函數可以使用,但由於一些令人不愉快的原因...我租用的V...

無障礙網頁accesskey

無障礙網頁accesskey...

accesskey 無障礙網頁導盲磚。 是為了要方便有需求的人,可利用鍵盤即可快速瀏覽網頁切換網頁位...

Please select an option

error

Hi, thank you for your participation, but you cannot vote repeatedly~

Join innstory now and start recording your story.

"Innstory" is a place to store stories. We are committed to becoming a warm platform. Deepening the bonds between people is our direction.
We are convinced that the blockchain between people is not just a cold calculation. Join us now.

Wrong format