‘‘);$(location).prop(‘href‘
$("#pic").click(function(){
location.href=‘newpage.html‘;
});
上面的相当于<a href="http://www.mamicode.com/newpage.html" target="_self"><img src="http://www.mamicode.com/img.jpg" /></a>
$("#pic").click(function(){ window.open(‘newpage.html‘); });
相当于<a href="http://www.mamicode.com/newpage.html" target="_blank"><img src="http://www.mamicode.com/img.jpg" /></a>
我们可以操作http的重定向来跳转
window.location.replace("http//www.jb51.net");
使用href来跳转
window.location.href = "http//www.jb51.net";
使用jQuery的属性替换要领
$(location).attr(‘href‘, ‘‘); $(window).attr(‘location‘,‘‘); $(location).prop(‘href‘, ‘http//www.jb51.net‘)
使用jQuery的属性替换要领结束
js和jq跳转到另一个页面或者在另一个窗口打开页面
,温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/31707.html