0
点赞
收藏
分享

微信扫一扫

radio单选按钮选中时当前页面实现跳转

下面是一个单选的span标签:

<span style="width: 500px;">
    <input type="radio" name="chart" value="overAll" checked="checked"/>搜狗
    <input type="radio" name="chart" value="interfaceUse"  style="margin-left:35px"/>百度
    <input type="radio" name="chart" value="area" style="margin-left:35px"/>火狐
</span>

当改变checked属性时在当前页面实现跳转js实现如下

$('input[type=radio][name=chart]').change(function() {
    if (this.value == 'overAll') {
    		window.location.href="www.sougou.com";
    }else if (this.value == 'interfaceUse') {
    		window.location.href="www.baidu.com";
    }else if(this.value == 'area'){
    		window.location.href="www.firefox.com.cn";
    }
});

因为使用的是本地路径所以跳转不进去,你们可以不使用本地路径

举报

相关推荐

0 条评论