可是我连不上!!我的原代码:<script language = "JavaScript"> function getRadioValue(radioObject) { var value = null for (var i=0; i<radioObject.length; i++) { if (radioObject[i].checked) { value = radioObject[i].value break } }if(value=="用户"){ gourl="http://www.sina.com.cn" window.licalhost.hash=gourl
W="www.csdn.net"
if(a=="F")
{
执行W连接!!
}
function getRadioValue(radioObject) {
var value = null
for (var i=0; i<radioObject.length; i++) {
if (radioObject[i].checked) {
value = radioObject[i].value
break }
}if(value=="用户"){
gourl="http://www.sina.com.cn"
window.licalhost.hash=gourl
}else{
alert("1234556677");
}}
</script><form name="form1">
<p>
<input type="radio" name="songs" value="用户">
按用户 </p>
<p>
<input type="radio" name="songs" value="水点">
按水点
<input type="text" name="text">
</p>
<p> </p>
<input type="button" name="Submit" value="下一步" onClick="getRadioValue(this.form.songs)">
</form>
gourl="http://www.sina.com.cn"
window.licalhost.hash=gourl
}
应为
if(value=="用户"){
gourl="http://www.sina.com.cn"
window.location.href=gourl
}
你的只有一个错误,就是下面这句
window.location=gourl
我把你原来的切过来,你再试试!
<html>
<head>
<title>无标题文档</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<script language = "JavaScript">
function getRadioValue(radioObject) {
var value = null
for (var i=0; i<radioObject.length; i++) {
if (radioObject[i].checked) {
value = radioObject[i].value
break }
}if(value=="用户"){
gourl="http://www.sina.com.cn"
window.location=gourl
}else{
alert("1234556677");
}}
</script><form name="form1">
<p>
<input type="radio" name="songs" value="用户">
按用户 </p>
<p>
<input type="radio" name="songs" value="水点">
按水点
<input type="text" name="text">
</p>
<p> </p>
<input type="button" name="Submit" value="下一步" onClick="getRadioValue(this.form.songs)">
</form>
</html>