+ -
当前位置:首页 → 问答吧 → radio 切换页面

radio 切换页面

时间:2011-12-21

来源:互联网

请教各位大大:

如何让html radio选了之后就切换不同页面?谢谢

作者: pushman   发布时间: 2011-12-21

Try this one:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<html>
<body>
<script language=javascript> var destination=""; function setDestination(d) {   destination=d; } function check() { if (destination=="g") location.href="http://www.google.com"; else   if (destination=="Y")    location.href="http://www.yahoo.com";   else     return false; }
</script>
<form onsubmit="return false;"> <input type="radio" name=w onclick="setDestination('Y')">Yahoo<br> <input type="radio" name=w onclick="setDestination('g')">Google<br> <input type="button" value="go" onclick="check()">
</form>
</body>
</html>

作者: roytsang   发布时间: 2011-12-21