我的代码是: html with the js in section please ch3eck out 我需要生成五个问题形式的结果并将其显示在页面的最后一部分我哪里出错了我正在使用 innerhtml js 的东西来生成结果在最后一节
<div id="section1">
<script type="text/javascript">
function changeText2() {
alert("working");
var count1 = 0;
var a = document.forms["myForm"]["drop1"].value;
var b = document.forms["myForm"]["drop2"].value;
alert(document.forms["myForm"]["drop2"].value);
var c = document.forms["myForm"]["drop3"].value;
var d = document.forms["myForm"]["drop4"].value;
var e = document.forms["myForm"]["drop5"].value;
var f = document.forms["myForm"]["drop6"].value;
if (a === 2) {
count1++;
alert(count1);
} else {
alert("lit");
}
if (b === 2) {
count1++;
} else {
alert("lit");
}
if (c === 2) {
count1++;
} else {
alert("lit");
}
if (d === 2) {
count1++;
} else {
alert("lit");
}
if (e === 2) {
count1++;
} else
alert("lit");
}
alert(count1);
document.getElementById('boldStuff2').innerHTML = count1;
</script>
<form name="myForm">
<p>1)  Who won the 1993 “King of the Ring”?</p>
<div>
<select id="f1" name="drop1">
<option value="0" selected="selected">-- Select --</option>
<option value="1">Owen Hart</option>
<option value="2">Bret Hart</option>
<option value="3">Edge</option>
<option value="4">Mabel</option>
</select>
</div>
<!--que1-->
<p>2)  What NHL goaltender has the most career wins?</p>
<div>
<select id="f2" name="drop2">
<option value="0" selected="selected">-- Select --</option>
<option value="1">Grant Fuhr</option>
<option value="2">Patrick Roy</option>
<option value="3">Chris Osgood</option>
<option value="4">Mike Vernon</option>
</select>
</div>
<!--que2-->
<p>3)  What Major League Baseball player holds the record for
all-time career high batting average?</p>
<div>
<select id="f3" name="drop3">
<option value="0" selected="selected">-- Select --</option>
<option value="1">Ty Cobb</option>
<option value="2">Larry Walker</option>
<option value="3">Jeff Bagwell</option>
<option value="4">Frank Thomas</option>
</select>
</div>
<!--que3-->
<p>4)  Who among the following is NOT associated with billiards
in India?</p>
<div>
<select id="f4" name="drop4">
<option value="0" selected="selected">-- Select --</option>
<option value="1">Subash Agrawal</option>
<option value="2">Ashok Shandilya</option>
<option value="3">Manoj Kothari</option>
<option value="4">Mihir Sen</option>
</select>
</div>
<!--que4-->
<p>5)  Which cricketer died on the field in Bangladesh while
playing for Abahani Club?</p>
<div>
<select id="f5" name="drop5">
<option value="0" selected="selected">-- Select --</option>
<option value="1">Subhash Gupte</option>
<option value="2">M.L.Jaisimha</option>
<option value="3">Lala Amarnath</option>
<option value="4">Raman Lamba</option>
</select>
</div>
<!--que5--> <a href="#services" class="page_nav_btn next"><input type='button' onclick='changeText2()' value='NEXT'/></a>
</form>
</div>
<div id="section2"></div>...
<div id="results">
<b id='boldStuff2'>fff ggg</b>
</div>
需要在最后一个 div 中显示每个部分的结果,如脚本中所示...
第一部分的 js 不起作用请帮助我我哪里出错了....