jquery获取链接地址和跳转
一、获取地址栏参数的方法
获取地址栏参数的方法
<scripttype="text/javascript">(function($){$.getUrlParam=function(name){varreg=newRegExp("(^|&)"+name+"=([^&]*)(&|$)");varr=window.location.search.substr(1).match(reg);if(r!=null)returnunescape(r[2]);returnnull;}})(jQuery);$(function(){alert(window.location.href);alert($.getUrlParam('page'));})</script>
获取href连接:
$(document).ready(function(){$("button").click(function(){alert($("#w3s").attr("href"));});});
二、跳转:
1.在原来的窗体中直接跳转用
window.location.href="你所要跳转的页面";
2、在新窗体中打开页面用:
window.open('你所要跳转的页面');window.history.back(-1);返回上一页
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。