คือ ผมมี radio button 2 รายการ คือ
ชื่อธนาคาร และประเภทบัญชี
โดยธนาคารมี 3 ชื่อ หากผมเลือกธนาคารที่ 1
Radio button อีกส่วน คือ ประเภทบัญชี ให้เลือกประเภทบัญชี มี 2 รายการ
แต่หากผมเลือกธนาคารที่ 2
Radio button ที่เป็นเภทบัญชีต้องเป็น Disable ครับ
มีวิธีไหนบ้างครับ ถ้าพอจะแก้โจทย์นี้ได้ (หน้าเพจเป็น .php)
ขอบคุณล่วงหน้าครับ
รบกวนครับ ต้องการเลือก Radio Button แล้ว Disable ปุ่มอื่น
Moderator: mindphp
-
- PHP Sr. Member
- Posts: 54
- Joined: 04/01/2009 7:54 pm
-
- PHP Super Member
- Posts: 480
- Joined: 25/01/2010 11:57 pm
- Contact:
Re: รบกวนครับ ต้องการเลือก Radio Button แล้ว Disable ปุ่มอื่น
น่าจะประมาณนี้หรือป่าว
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
function enabletype()
{
var e1 = document.getElementsByName("accounttype").item(0);
var e2 = document.getElementsByName("accounttype").item(1);
e1.checked = "checked";
e1.disabled = false;
e2.disabled = false;
}
function disabletype()
{
var e1 = document.getElementsByName("accounttype").item(0);
var e2 = document.getElementsByName("accounttype").item(1);
e1.checked = false;
e1.disabled = true;
e2.checked = false;
e2.disabled = true;
}
</script>
</head>
<body>
<table width="400" border="0" cellpadding="0" cellspacing="4">
<tr>
<td>
<input type="radio" name="bank" id="bank1" onclick="enabletype();" checked="checked"/>กสิกรไทย
<input type="radio" name="bank" id="bank2" onclick="disabletype();" />กรุงเทพ
<input type="radio" name="bank" id="bank3" />กรุงไทย
</td>
</tr>
<tr>
<td>
<input type="radio" name="accounttype" id="save" checked="checked" />ออมทรัพย์
<input type="radio" name="accounttype" id="daily" />รายวัน
</td>
</tr>
</table>
</body>
</html>
-
- Similar Topics
- Replies
- Views
- Last post
-
-
ปิด textbox เพื่อให้ไม่สามารถแก้ไขข้อมูลได้ด้วย radio button
by benzas00123 » 29/01/2020 11:31 am » in HTML CSS - 0 Replies
- 794 Views
-
Last post by benzas00123
29/01/2020 11:31 am
-
-
-
ดึงข้อมูล มาเเสดงเป็น radio button จะทำได้ยังค่ะ
by thatsawan » 29/07/2014 10:00 pm » in Programming - PHP - 5 Replies
- 5361 Views
-
Last post by thatsawan
30/07/2014 2:53 pm
-
-
-
อยากทราบโค๊ด php user ต้องติ๊ก radio button ทุกตัวจึงสามารถไปหน้าต่อไปได้
by php newbie » 22/03/2012 7:48 pm » in Programming - PHP - 2 Replies
- 2409 Views
-
Last post by dexjanghan
27/03/2012 2:52 pm
-
-
- 5 Replies
- 2865 Views
-
Last post by oatgamess
06/09/2012 1:01 pm
-
-
ต้องการเลือก select tag แล้วส่งค่ากลับมาแล้วแต่ไม่รู้จะนำมาใช้ยังไงครับ
by bankjittapol » 08/11/2019 11:24 am » in JavaScript & Jquery Ajax - 4 Replies
- 837 Views
-
Last post by bankjittapol
08/11/2019 3:28 pm
-
Who is online
Users browsing this forum: No registered users and 3 guests