ユーザーが回答を選択すると、以下のコードは異なる結果をもたらすはずです。ただし、同じ結果が得られます。ボタンを押しても同じ結果になるのはなぜですか?
1.Is the network problem affecting just your pc? <BR>
<select id="Area">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>
<br>
<br><p>
2.Can you access the internet? <BR>
<select id="Internet">
<option value="Yes">Yes</option>
<option value="No">No</option>
<option value="Yes,but is slow">Yes,but is slow</option>
<option value="Drop in connection">Drop in connection</option>
</select>
<br>
<br><p>
3.Are you receiving any error message saying remote system could not be found or connection has timed out?<BR>
<select id="Errors">
<option value="Remote">Remote system could not be found</option>
<option value="Connection">Connection has timed out</option>
<option value="No">No error messages </option>
</select>
<br>
<br><p>
4.Have you changed any software or Hardware before the problem occurred?<BR>
<select id="Change">
<option value="Software">Software</option>
<option value="Hardware">Hardware</option>
<option value="Both">Both</option>
<option value="None">None </option>
</select>
<br>
<br><p>
<button onclick="myFunction()">Detect</button>
<p id="Solution"></p>
<script>
function myFunction()
{
var AreaElem = document.getElementById("Area");
var Area = AreaElem.options[AreaElem.selectedIndex].value;
var InternetElem = document.getElementById("Internet");
var Internet= InternetElem.options[InternetElem.selectedIndex].value;
var ErrorsElem = document.getElementById("Errors");
var Errors= ErrorsElem.options[ErrorsElem.selectedIndex].value;
var ChangeElem = document.getElementById("Change");
var Change= ChangeElem.options[ChangeElem.selectedIndex].value;
if (Area=="Yes"||Internet=="Yes"||Errors=="No"||Change=="No") {
x="check your cable is not cut or loose";
} else if (Area=="Yes"||Internet=="Yes"||Errors=="No"||Change=="Both") {
x="network connections ";
} else {
x="other problems....";
}
document.getElementById("Solution").innerHTML=x;
}
</script>