关于跳转到二级页面选项卡指定位置

要求效果 : index1.html→跳转至→index2.html中的第三个选项卡

做法:

1.在index2.html页中加入以下

$(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;
  }
  var url_status = $.getUrlParam('process');
  if(url_status == 1) {
    $('#tab_1').click();
  } else if(url_status == 2) {
    $('#tab_2').click();
  } else if(url_status == 3) {
    $('#tab_3').click();
  }
});

2.在index1.html链接位置 接入 href='index2.html?process=3'

原理:通过改变 index2.html的尾缀 来判断具体跳转到index2.html页面的哪个选项卡.

posted @ 2017-02-10 13:33  潜水小龙  阅读(1335)  评论(0编辑  收藏  举报