⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tab.js

📁 CallSun 人才招聘求职系统 V2.20
💻 JS
字号:
var Browser = new Object();
Browser.isMozilla = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined') && (typeof HTMLDocument!='undefined');
Browser.isIE = window.ActiveXObject ? true : false;
Browser.isFirefox = (navigator.userAgent.toLowerCase().indexOf('firefox')!=-1);
Browser.isOpera = (navigator.userAgent.toLowerCase().indexOf('opera')!=-1);
if (Browser.isFirefox) { // entend Event Mod for FireFox
  extendEventObject();
}
function extendEventObject() {
  Event.prototype.__defineGetter__('srcElement', function () {
    var node = this.target;
    while (node.nodeType != 1) node = node.parentNode;
    return node;
  });

  Event.prototype.__defineGetter__('fromElement', function () {
    var node;
    if (this.type == 'mouseover')
      node = this.relatedTarget;
    else if (this.type == 'mouseout')
      node = this.target;
    if (!node) return;
    while (node.nodeType != 1) node = node.parentNode;
    return node;
  });

  Event.prototype.__defineGetter__('toElement', function () {
    var node;
    if (this.type == 'mouseout')
      node = this.relatedTarget;
    else if (this.type == 'mouseover')
      node = this.target;
    if (!node) return;
    while (node.nodeType != 1) node = node.parentNode;
    return node;
  });

  HTMLElement.prototype.insertAdjacentElement = function(where, parsedNode){
    switch(where){
      case "beforeBegin":
        this.parentNode.insertBefore(parsedNode,this);
        break;
      case "afterBegin":
        this.insertBefore(parsedNode,this.firstChild);
        break;
      case "beforeEnd":
        this.appendChild(parsedNode);
        break;
      case "afterEnd":
        if(this.nextSibling)
          this.parentNode.insertBefore(parsedNode,this.nextSibling);
        else
          this.parentNode.appendChild(parsedNode);
        break;
    }
  }

  HTMLElement.prototype.insertAdjacentHTML = function(where, htmlStr){
    var r = this.ownerDocument.createRange();
    r.setStartBefore(this);
    var parsedHTML = r.createContextualFragment(htmlStr);
    this.insertAdjacentElement(where,parsedHTML);
  }
}

var tabDelay = 150;
var waitInterval;
var tempref;

function getTBprefixName(str,sta)
{
  if(str.indexOf("active")!=-1 || str.indexOf("normal")!=-1) str=str.substr(6);
    else if(str.indexOf("over")!=-1) str=str.substr(4);
      else str="";
  return sta+str;
}
function IsChild(cNode,pNode)
{
  while(cNode!=null)
  {
    cNode=cNode.parentNode;
    if(cNode==pNode) return true; 
  }
  return false;
}
function initTabs()
{
  for(var i=0;i<arguments.length;i++)
  {
    var ulobj=document.getElementById(arguments[i]);
    ulist=ulobj.getElementsByTagName('li');
    for(var j=0;j<ulist.length;j++)
    {
      var tabList=ulist[j];
      if(tabList.parentNode.parentNode!=ulobj) continue;
      tabList.setActive=function(bactive){
        var ulistlink=this.getAttribute('rel');
        ulistlink=document.getElementById(ulistlink);
        if(bactive){
          this.status='active';
          this.className=getTBprefixName(this.className,'active');
          ulistlink.style.display='block';
        }else{
          this.status='normal';
          this.className=getTBprefixName(this.className,'normal');
          ulistlink.style.display='none';
        }
      }
      tabList.LoadTab=function(){
        this.setActive(true);
        this.parentNode.parentNode.activetab.setActive(false);
        this.parentNode.parentNode.activetab=this;
      }
      tabList.onmouseover=function(aEvent){
        var myEvent = window.event ? window.event : aEvent;
        var fm=myEvent.fromElement;
        if(IsChild(fm,this) || fm==this) return;//过滤子元素event
        if(this.status=='active') return;
        tempref=this;
        clearTimeout(waitInterval);
        waitInterval=window.setTimeout('tempref.LoadTab();',tabDelay);
      }
      tabList.onmouseout=function(aEvent){
        var myEvent = window.event ? window.event : aEvent;
        var em=myEvent.toElement;
        if(IsChild(em,this) || em==this) return; //过滤子元素event
        if(this.status=='active') return;
        clearTimeout(waitInterval);
      }
      if(tabList.className=='active'){
        tabList.setActive(true);
        ulobj.activetab=tabList;
      }
    }
    if(ulobj.activetab==null) ulobj.activetab=ulist[0];
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -