开发者社区> 问答> 正文

请问如何通过 javascript 判断 url 以打开不同大小的窗口?

$('#playlist ul li > a').click(function(){
    if(href.indexOf("tudou.com") !== -1){
        window.open(this.href, "","top=100,left=355,width=640,height=500");
    }else{
        window.open(this.href, "","top=284,left=370,width=610,height=290");
    }
    return false;
});

这样写无法实现。。求助

展开
收起
杨冬芳 2016-06-14 17:12:54 1859 0
1 条回答
写回答
取消 提交回答
  • IT从业
    $('#playlist ul li > a').click(function(){
        var href = this.href;
        if(href.indexOf("tudou.com") !== -1){
            window.open(href, "","top=100,left=355,width=640,height=500");
        }else{
            window.open(href, "","top=284,left=370,width=610,height=290");
        }
        return false;
    });
    2019-07-17 19:38:15
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
JavaScript函数 立即下载
Delivering Javascript to World 立即下载
编程语言如何演化-以JS的private为例 立即下载