Get the App
SLTechnology News&Howtos  ›  Development  › 

How to write AJAX Tab

Shulou Source: shulou.com Published: 2022-06-03 08:36:12 11月15日 Update

This article focuses on "how to write AJAX Tab", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to write AJAX Tab.

The code is as follows:

/ / 163 AJAX Tab

/ / update 2006.10.18

/ / added mouse delay sensing feature.

/ / update 2006.10.8

The / / A tag href attribute will retain the original HTML function. Add the urn attribute to the AJAX Load path.

/ / update 2006.10.11

/ / fixed IE5.0 undefined undefined errors and added script error shielding

Var Browser = new Object ()

Browser.isMozilla = (typeof document.implementation! = 'undefined') & & (typeof document.implementation.createDocument! =' undefined') & & (typeof HTM LDocumentals assigned 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 [XSS _ clean]

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 [XSS _ clean]

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 [XSS _ clean]

Return node

});

}

Function IsChild (cNode,pNode) {

While (cNodekeeper null) {

CNode= cNode[xss _ clean]

If (cNode==pNode) return true

}

Return false

}

Var ajccache=new Object ()

Var waitInterval

Var tempref

Var MouseDelayTime=150;// mouse induction delay 300ms

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 startajaxtabs () {

For (var iTuno Bandi)

Tags: Element content attribute error mouse learning delay utility deeper valid code interest function only practical easy to operate method more friends Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS NVidia Huawei Apple MariaDB