$("#pic").click(function(){ location.href='newpage.html'; });
上面的至關於<a href="newpage.html" target="_self"><img src="img.jpg" /></a>html
$("#pic").click(function(){ window.open('newpage.html'); });
至關於<a href="newpage.html" target="_blank"><img src="img.jpg" /></a>lua
咱們能夠利用http的重定向來跳轉spa
window.location.replace("http//www.jb51.net");.net
使用href來跳轉code
window.location.href = "http//www.jb51.net";htm
使用jQuery的屬性替換方法blog
$(location).attr('href', 'http://www.jb51.net'); $(window).attr('location','http://www.jb51.net'); $(location).prop('href', 'http//www.jb51.net')
使用jQuery的屬性替換方法結束get