一、獲取地址欄參數的方法
獲取地址欄參數的方法
<script type="text/javascript"> (function ($) { $.getUrlParam = function (name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if (r != null) return unescape(r[2]); return null; } })(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);返回上一頁