dreamwever cs5で別のボタンを選択してもラジオボタンの選択が解除されない

enter link description hereenter code here My problem is that the radio buttons won't deselect once selected. This form is connected to a PHP file that I build for my homework. In Dreamweaver if I keep the default value for the name attribute I don't have a problem with the buttons, but since the value of the name attribute has to match the name attribute in the PHP file I can't keep the default name. I've tried using group buttons and single buttons and copying them. In a text page I was able to get buttons to deselect when another button was selected. And then it stopped working, all the buttons stayed checked. I'm confused because I thought radio buttons contained boolean values, when one is selected the other is deselected. Any suggestions? Here is the code

 
 
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 <title>Homework 7</title>
 <script type="text/javascript">
 function edits()
 {
 if(document.getElementById("name").value=="")
 {
alert("Please enter your whole name.")
return false;
 }
if(document.getElementById("jarreau").checked=="")
 {
alert("Please enter your whole name.")
return false;
 }
else if(document.getElementById("aretha").checked=="")
 {
alert("Please enter your whole name.")
return false;
 }
else if(document.getElementById("withers").checked=="")
 {
alert("Please enter your whole name.")
return false;
}
else if(document.getElementById("joel").checked=="")
 {
alert("Please enter your whole name.")
return false;
}
else if(document.getElementById("warwidk").checked=="")
{
alert("Please enter your whole name.")
return false;
}
if(document.getElementById("rate").value=="")
{
alert("Please enter your whole name.")
return false;

if(document.getElementById("email").value=="")
{
alert("Please enter your whole name.")
return false;
 }
}
else return true;
}

 </script>
 
 </head>

 <body>
 

Old School Concert

 <table width="87%" border="0" cellspacing="0" cellpadding="2">
 <tr>
 <th align="left" width="19%" scope="col">Al Jarreau</th>
 <th align="left"width="13%" scope="col">Aretha Franklin</th>
  <th align="left"width="16%" scope="col">Bill Withers</th>
 <th align="left"width="19%" scope="col">Billy Joel</th>
 <th align="left"width="19%" scope="col">Dionne Warwick</th>
</tr>
<tr>
<td>Al Jarreau</td>
<td>aretha franklin</td>
<td>Bill Withers</td>
<td>Billy Joel</td>
<td>Dionne Warwick</td>
</tr>

In order to keep bringing you the best in old school legends please fill out this brief survey.

 <form name="service" method="post" action="concert.php" />
 
<input name="name" type="text" id="fname" size="20" maxlength="15" />
(optional)

<input name="name" type="text" id="lname" size="20" maxlength="15" /> (optional)










<input name="rate" type="text" id="rate" size="5" maxlength="2" />
<input name="email" type="text" id="email" size="45" maxlength="45" />




<input type="button" value="submit" name="" id="" onclick="edits()" /> </form> </body> </html>
0
追加された 編集された
ビュー: 1

1 答え

すべてのラジオボタンに同じ "名前"を付ける必要があります:

<input name="thesamegroup" type="button" value="submit"  id="" onclick="edits()" />
<input name="thesamegroup" type="text" id="email" size="45" maxlength="45" />
1
追加された
私はこの答えを受け入れますが、最初は混乱していました。同じ名前を持つ必要があるIDだと思っていました。
追加された 著者 swydell,