In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you how Firefox browsers are compatible with JS scripts, which are concise and easy to understand. I hope you can gain something through the detailed introduction of this article.
I would like to describe to you the problem of Firefox browser compatibility with JS scripts. Recently, I have done a project and encountered the problem of incompatibility between FireFox and IE scripts. For this reason, I have collected some compatible scripts from the Internet, which I will share with you here.
Firefox browser is compatible with JS scripts for reference
1.window.event compatible script
FunctiongetEvent () {/ / gets browser events that are compatible with both ie and ff writing if (document.all) returnwindow.event; func=getEvent.caller; while (functionally null) {vararg0=func.arguments [0]; if (arg0) {if ((arg0.constructor==Eventarg0.constructor==MouseEvent) (typeof (arg0) = = "object" & & arg0.preventDefault&&arg0.stopPropagation)) {returnarg0;}} funcfunc=func.caller;} returnnull;}
Firefox needs to be fetched with getEvent () before each event, otherwise it will be empty.
two。 Block Form submission events
Event.returnValue=false;//forIE evt.preventDefault (); / / forfirefox
3. Get event source
Varsource=event.srcElement//IE varsource=event.target//firefox
4. Add event-compatible writing
FunctionaddEvent (oElement,sEvent,func) {if (oElement.attachEvent) {oElement.attachEvent (sEvent,func);} else {sEventsEvent=sEvent.substring (2 sEvent,func,false); oElement.addEventListener (sEvent,func,false);}}
Usage: addEvent (window, "onload", Start)
5.Firefox registration innerText writing
/ register firefoxinnerText HTMLElement.prototype.__defineGetter__ ("innerText", function () {varanyString= ""; varchildS=this.childNodes; for (vari=0;iif (childcare [I] .nodeType = = 1) anyString+= childS[ I] .tagName = = "BR"?'\ nchildS.innerText; elseif (childS.nodeType = 3) anyString+= childS[ I] .nodeValue;} returnanyString;}); HTMLElement.prototype.__defineSetter__ ("innerText", function (sText) {this.textContent=sText;})
6. Length: FireFox length must be added with "px", IE does not matter
7. Child controls under the parent control: IE is "children" and FireFox is "childNodes"
8.XmlHttp
In IE, the content of the XmlHttp.send (content) method can be empty, but the firefox cannot be empty. You should use send (""), otherwise a 411 error will occur.
The above is how Firefox browsers are compatible with JS scripts. have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.