さて、私はこのようないくつかのラジオボタンを備えたhtmlフォームを持っています...
<tr class="AccountSettingtable">
<td class="tableHeader">+ Graphics</td>
<td class="tableHeader">Daily <input type="radio" name="graphics" value="daily" /></td>
<td class="tableHeader">Never <input type="radio" name="graphics" value="never" /></td>
</tr>
<tr class="AccountSettingtable">
<td class="tableElement">Logo Design</td>
<td><input type="radio" name="logo" /></td>
<td><input type="radio" name="logo" /></td>
</tr>
<tr class="AccountSettingtable">
<td class="tableElement">Flyers & Postar design</td>
<td><input type="radio" name="fly" /></td>
<td><input type="radio" name="fly" /></td>
</tr>
<tr class="AccountSettingtable">
<td class="tableElement">Print Media</td>
<td><input type="radio" name="print" /></td>
<td><input type="radio" name="print" /></td>
</tr>
<tr class="AccountSettingtable">
<td class="tableElement">Stationery</td>
<td><input type="radio" name="stationery" /></td>
<td><input type="radio" name="stationery" /></td>
</tr>
<tr class="AccountSettingtable">
<td class="tableElement">Packaging Design</td>
<td><input type="radio" name="packaging" /></td>
<td><input type="radio" name="packaging" /></td>
</tr>
<tr class="AccountSettingtable">
<td class="tableElement">Illustrations</td>
<td><input type="radio" name="illustration" /></td>
<td><input type="radio" name="illustration" /></td>
</tr>
このフォームでは、フォームの上部に2つのラジオボタンがあります。
1)毎日
2)決して。
それで、ユーザーがneverボタン(ラジオボタン)をクリックした場合にすべてのボタン(neverに関連する)を無効にする方法はありますか?これを行うにはどうすればよいですか?
どうもありがとう。
完全なコード..
<?php
include("include/session.php");
include("include/check.php");
include("database/db.php");
?>
<!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><?php echo $_SESSION['uname'] .'s'. " Profile"; ?></title>
<link rel="stylesheet" type="text/css" href="css/accountpage.css" />
<link rel="stylesheet" type="text/css" href="css/accountpage.css" />
<link rel="stylesheet" type="text/css" href="css/UserAccount.css"/>
<link rel="stylesheet" type="text/css" href="css/stylesheet.css" />
<script type="text/javascript">
$('input#never').bind('click', function() {
$('input.never').attr('disabled', 'disabled');
$('input.daily').attr('disabled', '');
});
$('input#daily').bind('click', function() {
$('input.never').attr('disabled', '');
$('input.daily').attr('disabled', 'disabled');
});
</script>
</head>
<body>
<div class="AccountSettingmiddle">
<table width="631">
<td class="tableHeader">Daily <input id="daily" type="radio" name="graphics" value="daily" /></td>
<td class="tableHeader">Never <input id="never" type="radio" name="graphics" value="never" /></td>
</tr>
<tr class="AccountSettingtable">
<td class="tableElement">Logo Design</td>
<td><input type="radio" name="logo" value="yes" class="daily" /></td>
<td><input type="radio" name="logo" value="no" class="never" /></td>
</tr>
<tr class="AccountSettingtable">
<td class="tableElement">Flyers & Postar design</td>
<td><input type="radio" name="fly" value="yes" class="daily" /></td>
<td><input type="radio" name="fly" value="no" class="never" /></td>
</tr>
<tr class="AccountSettingtable">
<td class="tableElement">Print Media</td>
<td><input type="radio" name="print" value="yes" class="daily" /></td>
<td><input type="radio" name="print" value="no" class="never" /></td>
</tr>
<tr class="AccountSettingtable">
<td class="tableElement">Stationery</td>
<td><input type="radio" name="stationery" value="yes" class="daily" /></td>
<td><input type="radio" name="stationery" value="no" class="never" /></td>
</tr>
<tr class="AccountSettingtable">
<td class="tableElement">Packaging Design</td>
<td><input type="radio" name="packaging" value="yes" class="daily" /></td>
<td><input type="radio" name="packaging" value="no" class="never" /></td>
</tr>
<tr class="AccountSettingtable">
<td class="tableElement">Illustrations</td>
<td><input type="radio" name="illustration" value="yes" class="daily" /></td>
<td><input type="radio" name="illustration" value="no" class="never" /></td>
</tr>
</table>
<script type="text/javascript">$(function() {
$('input#never').bind('click', function() { $('input.never').attr('disabled',
'disabled'); $('input.daily').attr('disabled', ''); }); $('input#daily').bind('click',
function() { $('input.never').attr('disabled', ''); $('input.daily').attr('disabled',
'disabled'); }); }); </script>
</div>
</body>
</html>