Javascript 每个单选按钮通过“onclick”而不是“submit”自动重定向到不同选择的不同页面

Javascript 每个单选按钮通过“onclick”而不是“submit”自动重定向到不同选择的不同页面,javascript,html,Javascript,Html,我想根据用户的不同选择重定向不同的页面,我的代码仅适用于一个页面&当我选择另一个页面时,它将挂起&仅显示第一个页面的内容。每次我都必须在浏览器中按back选项才能查看2、3或4页的内容,否则会卡住。代码是 <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> </script> <script type="t

我想根据用户的不同选择重定向不同的页面,我的代码仅适用于一个页面&当我选择另一个页面时,它将挂起&仅显示第一个页面的内容。每次我都必须在浏览器中按back选项才能查看2、3或4页的内容,否则会卡住。代码是

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> </script>
<script type="text/javascript">
function idForm(){
var selectvalue = $('input[name=choice]:checked', '#idForm').val();
if(selectvalue == "all"){
window.open('index.php','_self');
return true;
}
else if(selectvalue == "pc"){
window.open('pc.php','_self');
return true;
}
else if(selectvalue == "ps2"){
window.open('ps2.php','_self');
return true;
}else if(selectvalue == 'ps3'){
window.open('ps3.php','_self');
return true;
}else if(selectvalue == 'psp'){
window.open('psp.php','_self');
return true;
}
return false;
};
</script>
</head>
<body>
Games - This is the full List of Games, if you want to choose the games according to the Platform then select it <br /><br />
<form id="idForm">
<input type="radio" onClick="idForm()"  name="choice" value="all" checked/>All &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" onClick="idForm()"  name="choice" value="pc"/>PC &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio"  onclick="idForm()" name="choice" value="ps2"/>PS2 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio"  onclick="idForm()" name="choice" value="ps3"/>PS3 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio"  onclick="idForm()" name="choice" value="psp"/>PSP &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</form>
</body>
</html>
请帮助我解决此问题,方法是在浏览器中再次按“后退”选项,然后分别查看每个页面的内容,或者选择单选按钮“全部”、pc、ps2、ps3或psp(正常),而不挂起

提前谢谢。

为什么不简化

<form id="idForm">
<input type="radio" onClick="window.open('index.php','_self')"  name="choice" value="all" checked/>All 
<input type="radio" onClick="window.open('pc.php','_self')"  name="choice" value="pc"/>PC 
<input type="radio" onclick="window.open('ps2.php','_self')" name="choice" value="ps2"/>PS2 
<input type="radio" onclick="window.open('ps3.php','_self')" name="choice" value="ps3"/>PS3 
<input type="radio" onclick="window.open('psp.php','_self')" name="choice" value="psp"/>PSP 
</form>

我已经尝试过@chrisrth,但它只打开“pc.php”&然后再次挂起其他页面上的“ps2.php”/“ps3.php”。它只显示了“pc.php”页面的内容。听起来你可能会遇到一些问题。此代码适用于IE、Chrome、FF的最新版本