<script>
function check(){
if(form1.r1.value=="1")
form2.action ="http://..................";
else
if(form1.r1.value=="2")
form2.action ="http://..................";
else
form2.action ="http://..................";
end if
end if
form1.submit();
}
<script><form action="" method="post" target="_blank" name="form1">
<input type="radio"name="r1" value="1">
<input type="radio"name="r1" value="2">
<input type="radio"name="r1" value="3">
<input type="text" size="23" name="searchword">
<input type="submit" value="查询" width="96" height="25" onclick="check()">
</form>
function check(){
if(form1.r1.value=="1")
form2.action ="http://..................";
else
if(form1.r1.value=="2")
form2.action ="http://..................";
else
form2.action ="http://..................";
end if
end if
form1.submit();
}
<script><form action="" method="post" target="_blank" name="form1">
<input type="radio"name="r1" value="1">
<input type="radio"name="r1" value="2">
<input type="radio"name="r1" value="3">
<input type="text" size="23" name="searchword">
<input type="submit" value="查询" width="96" height="25" onclick="check()">
</form>
<script>
function check(){
if(form1.r1.value=="1")
form1.action ="http://..................";
else
if(form1.r1.value=="2")
form1.action ="http://..................";
else
form1.action ="http://..................";
end if
end if
form1.submit();
}
<script>
function check(){
var Sel='';
var Url='';
var rs=document.getElementsByName('r1');
for(var x=0;x<rs.length;x++)
{
if(rs[x].checked){
Sel=rs[x].value;
break;
}
}
if(Sel==''){
alert('请选择');
return false;
}
switch(Sel){
case 'A':
Url='http://www.sina.com.cn';
break;
case 'B':
Url='http://www.csdn.net';
break;
case 'C':
Url='www.aspnt.com';
break;
}
form1.action=Url;
form1.method ="post";
return true;
}
</script><form action="" method="post" target="_blank" name="form1" onsubmit="return check()">
<input type="radio" name="r1" value=A>
<input type="radio" name="r1" value=B>
<input type="radio" name="r1" value=C>
<input type="text" size="23" name="searchword">
<input type="submit" value="查询" width="96" height="25" >
</form> 可以添加无限个 radio 只要在
switch(Sel){
//加对相应的 case ??:
}
把radio改成checkbox
也就是可以同时打开几个。