用window.location.href的就只能在当前页面打开,不能打开新窗口的 点击这里 点击这里 可以用window.open();方法来实现新窗口的跳转
把你第22行改成下面这样的,就可以了
window.location.href="http://"+a;
将其改为:window.open(a,'','width=200,height=100');其中window.open()中可以添加各种参数,具体的参数,请参看w3c的文档
window.location.href="http://www.baidu.com"