好吧,我有几个像这样的单选按钮的 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>
在此表单中,表单顶部有两个单选按钮。
1) 每天
2) 从不。
那么,如果用户单击从不按钮(单选按钮),有什么方法可以禁用所有按钮(与从不相关),我该怎么做?
非常感谢。
完整的代码..
<?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>