【发布时间】:2015-11-25 08:57:28
【问题描述】:
我的复选框有问题。如果我选择一个值并验证,我不能第二次这样做,它不起作用。查看其他问题,我发现我可能必须将 prop() 函数与“checked”属性一起使用,但它仍然无法正常工作。
这是我的网站:http://nts.nuvision.co.za/index.php/training/
这是我的javascript:
$('#one').hide();
$('#two').hide();
$('#three').hide();
$('#show').click(function() {
$('#pgc-224-0-1').css("margin-top", "0px");
switch(document.getElementById('trainingcourses').value) {
case 'one':
$('#one').show();
$('#two').hide();
$('#three').hide();
$("#trainingcourses").prop('checked', false);
break;
case 'two':
$('#two').show();
$('#one').hide();
$('#three').hide();
$("#trainingcourses").prop('checked', false);
break;
case 'three':
$('#three').show();
$('#two').hide();
$('#one').hide();
$("#trainingcourses").prop('checked', false);
break;
}
});
这里是我的 HTML:
<form id="trainingform">
<select id="trainingcourses" style="font-size: 12pt;">
<option style="font-size: 12pt;" value="one">Sugar and Suite CRM End User Training</option>
<option style="font-size: 12pt;" value="two">Sugar & Suite CRM Advanced End User Training</option>
<option style="font-size: 12pt;" value="three">Sugar and Suite CRM Administrator : Getting Started</option>
</select><input id="show" style="margin-top: -25px; margin-left: 20px;" name="show" type="submit" value="Show more information" onclick="location.href='http://nts.nuvision.co.za/index.php/training/#' + document.getElementById('trainingcourses').value; return false;"/></form>
<div id="one"> (...) </div>
<div id="two"> (...) </div>
<div id="three"> (...) </div>
【问题讨论】:
-
复选框或下拉菜单?...请让您的问题更清楚..
-
下拉我的错误,对不起
-
感谢提供链接,但实际上我在做一些研究时看到了它,它对我不起作用
-
非常感谢!
标签: javascript jquery html