Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write AJAX Tab

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report