我的问题是:我找到了一些代码。我该怎么做才能运行我所说的内容?我想当有人点击菜单项时,它会删除复选框值。(未选中)我的代码是这样的:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$(".form-row").hide();
$("#divListBox").find(":checked").each(function() {
$(this).removeAttr("checked");
});
$("#course_english").change(function() {
if ($("#course_english").val() == "MA English") {
$(".form-row").show();
} else {
$(".form-row").hide();
}
});
});
</script>
</head>
<body>
<select id="course_english" class="" name="course_english">
<option value="">--Select One--</option>
<option value="MA English">MA English</option>
<option value="B. A. (Hons.) with Mass Communication">B.A. (Hons.) with Mass Communication</option>
<option value="M. A. (English)">M. A. (English)</option> <option value="M. Phil.">M. Phil.</option>
</select>
<div class="form-row" id="divListBox">
<label for="sem_1_ma_english-poetry">
<input id="sem_1_ma_english-poetry" class="sem_1_ma_english" type="checkbox" value="Poetry" name="sem_1_ma_english[]">
Poetry
</label>
<label for="sem_1_ma_english-drama">
<input id="sem_1_ma_english-drama" class="sem_1_ma_english" type="checkbox" value="Drama" name="sem_1_ma_english[]">
Drama
</label>
<label for="sem_1_ma_english-fiction">
<input id="sem_1_ma_english-fiction" class="sem_1_ma_english"
type="checkbox" value="Fiction" name="sem_1_ma_english[]">
Fiction
</label>
<label for="sem_1_ma_english-prose">
<input id="sem_1_ma_english-prose" class="sem_1_ma_english" type="checkbox" value="Prose" name="sem_1_ma_english[]">
Prose
</label></div>
</body>
</html>