我有一个表单,它根据用户对一组select
元素的选择来重定向用户。我正在尝试将其转换为使用单选按钮而不是选择列表,但保留原始功能。
<form>
<p>option1 </p>
<select id="option1">
<option value="0" id="Select">Select</option>
<option value="1" id="coffee">Coffee</option>
</select>
<p>option2</p>
<select id="option2">
<option value="0" id="Select">Select</option>
<option value="1" id="White">White</option>
<option value="2" id="Black">Black</option>
</select>
<p>option3</p>
<select id="option3">
<option value="0" id="Select">Select</option>
<option value="1" id="std">STD</option>
<option value="2" id="300">300</option>
<option value="3" id="500">500</option>
</select>
<p>option4</p>
<select id="option4">
<option value="0" id="Select">Select</option>
<option value="1" id="america">America (NT - ST)</option>
<option value="2" id="australia">Australia and Oceania</option>
</select>
<br><br>
<input onclick="goToPage();" type="button" value="Submit" />
</form>
<script type="text/javascript">
function goToPage()
{
var option1 = document.getElementById("option1").value;
var option2 = document.getElementById("option2").value;
var option3 = document.getElementById("option3").value;
var option4 = document.getElementById("option4").value;
if (option1==1 && option2==1 && option3==1 && option4==1) { window.location = "http://www.testint.com/us"; }
else if (option1==1 && option2==2 && option3==3 && option4==2) { window.location = "http://www.testing.com/au"; }
}
</script>