Dreamweaver 单选按钮赢得';t在dreamwever cs5中选择另一个按钮时取消选择
Dreamweaver 单选按钮赢得';t在dreamwever cs5中选择另一个按钮时取消选择,dreamweaver,Dreamweaver,在此处输入代码我的问题是,单选按钮一经选择就不会取消选择。此表单连接到我为家庭作业构建的php文件。在Dreamweaver中,如果保留name属性的默认值,则按钮不会有问题,但由于name属性的值必须与php文件中的name属性匹配,因此无法保留默认名称。我尝试过使用组按钮和单个按钮并复制它们。在一个文本页面中,当另一个按钮被选中时,我能够得到要取消选择的按钮。然后它停止工作,所有的按钮都被检查过了。我很困惑,因为我认为单选按钮包含布尔值,当一个被选中时,另一个被取消选中。有什么建议吗?这是密
在此处输入代码
我的问题是,单选按钮一经选择就不会取消选择。此表单连接到我为家庭作业构建的php文件。在Dreamweaver中,如果保留name属性的默认值,则按钮不会有问题,但由于name属性的值必须与php文件中的name属性匹配,因此无法保留默认名称。我尝试过使用组按钮和单个按钮并复制它们。在一个文本页面中,当另一个按钮被选中时,我能够得到要取消选择的按钮。然后它停止工作,所有的按钮都被检查过了。我很困惑,因为我认为单选按钮包含布尔值,当一个被选中时,另一个被取消选中。有什么建议吗?这是密码
<!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>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>
<style type="text/css">
body {
background-color: #F9F;
}
h1 {
font-size: xx-large;
color: #FFF;
}
</style>
</head>
<body>
<h1 font color="#fff">Old School Concert</h1>
<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><img src="al jarreau.jpg" width="247" height="204" alt="Al Jarreau" /></td>
<td><img src="images/aretha franklin.jpg" width="198" height="204" alt="aretha franklin" /></td>
<td><img src="Bill Withers.jpg" width="192" height="204" alt="Bill Withers" /></td>
<td><img src="billy joel.jpg" width="225" height="204" alt="Billy Joel" /></td>
<td><img src="Dionne Warwick.jpg" width="176" height="204" alt="Dionne Warwick" /></td>
</tr>
家庭作业7
函数编辑()
{
if(document.getElementById(“name”).value==“”)
{
警告(“请输入您的全名。”)
返回false;
}
if(document.getElementById(“jarreau”).checked==“”)
{
警告(“请输入您的全名。”)
返回false;
}
else if(document.getElementById(“aretha”).checked==“”)
{
警告(“请输入您的全名。”)
返回false;
}
else if(document.getElementById(“withers”).checked==“”)
{
警告(“请输入您的全名。”)
返回false;
}
else if(document.getElementById(“joel”).checked==“”)
{
警告(“请输入您的全名。”)
返回false;
}
else if(document.getElementById(“warwidk”).checked==“”)
{
警告(“请输入您的全名。”)
返回false;
}
if(document.getElementById(“rate”).value==“”)
{
警告(“请输入您的全名。”)
返回false;
if(document.getElementById(“email”).value==“”)
{
警告(“请输入您的全名。”)
返回false;
}
}
否则返回true;
}
身体{
背景色:#F9F;
}
h1{
字体大小:xx大号;
颜色:#FFF;
}
旧式音乐会
艾尔贾诺
阿瑞莎·富兰克林
比尔·威瑟斯
比利·乔尔
狄昂华薇克
为了给你带来最好的古老传说,请填写这份简短的调查报告。
名字:
(可选)
姓氏:
(可选)
您最喜欢哪种性能:
艾尔贾诺
阿瑞莎·富兰克林
比尔·威瑟斯
比利·乔尔
狄昂华薇克
从1分到10分,你觉得这场音乐会怎么样?
您的电子邮件地址:
你的评论:
您必须为所有单选按钮提供相同的“名称”,如:
我接受这个答案,但一开始我很困惑,我以为是ID必须具有相同的名称。
<form name="service" method="post" action="concert.php" />
<label for="fname">First name:</label>
<input name="name" type="text" id="fname" size="20" maxlength="15" />
(optional)
<br />
<label for="lname">Last name:</label>
<input name="name" type="text" id="lname" size="20" maxlength="15" />
(optional)<br />
<label>Which performance you liked best:</label><br />
<p>
<label>
<input type="radio" name="jarreau" value="radio" id="RadioGroup1_0"/>
Al Jarreau</label>
<br />
<label>
<input type="radio" name="aretha" value="radio" id="RadioGroup1_1" />
Aretha Franklin</label>
<br />
<label>
<input type="radio" name="withers" value="radio" id="RadioGroup1_2" />
Bill Withers</label>
<br />
<label>
<input type="radio" name="joel" value="radio" id="RadioGroup1_3" />
Billy Joel</label>
<br />
<label>
<input type="radio" name="warwick" value="radio" id="RadioGroup1_4" />
Dionne Warwick</label>
</p>
<br />
<label for="rate">On a scale of 1 to 10 how would you rate this concert?</label>
<br />
<input name="rate" type="text" id="rate" size="5" maxlength="2" />
<label for="email"><br />
Your email address:</label>
<br />
<input name="email" type="text" id="email" size="45" maxlength="45" />
</p>
<p>
<label for="comment">Your comments:</label>
<textarea name="comment" cols="50" rows="5" id="comment"></textarea>
</p>
<input type="button" value="submit" name="" id="" onclick="edits()" />
</form>
</body>
</html>
<input name="thesamegroup" type="button" value="submit" id="" onclick="edits()" />
<input name="thesamegroup" type="text" id="email" size="45" maxlength="45" />