if (document.documentElement && document.documentElement.scrollTop) { t = document.documentElement.scrollTop ;//The top of the scroll bar l = document.documentElement.scrollLeft;//The left end of the scroll bar w = document.documentElement.scrollWidth;//The width of the scroll bar, that is, the width of the page h = document.documentElement.scrollHeight;//The height of the scroll bar l = document. body.scrollLeft; w = document.body.scrollWidth; h = document.body.scrollHeight; } return { t: t, l: l, w: w, >
Copy code
The code is as follows:
function getPageWidth(){ var pageWidth = window.innerWidth; if (typeof pageWindth != "number") { if (document.compatMode == "CSS1Compat") { pageWidth = document.documentElement.clientWidth;
function(){ var Sys = {}; var ua = navigator.userAgent.toLowerCase(); var s; (s = ua.match(// msie ([d.] )/)) ? Sys.ie = s[1] : (s = ua.match(/firefox/([d.] )/)) ? Sys.firefox = s[1] : ( s = ua.match(/chrome/([d.] )/)) ? Sys.chrome = s[1] : (s = ua.match(/opera.([d.] )/)) ? Sys. opera = s[1] : (s = ua.match(/version/([d.] ).*safari/)) ? Sys.safari = s[1] : 0;
if (Sys .ie != null) { return ("firefox:" Sys.firefox);//Determine the firefox browser and version number } if (Sys.chrome != null) { return ("chrome:" Sys.chrome) ; // Judge the Chrome browser and version number } if (sys.opera! = Null) { Return ("Opera:" sys.opra); } if (Sys.safari != null) { return ("safari:" Sys.safari);//Determine the safari browser and version number } }
Sometimes, I really don’t understand what IE is always doing and always trying to be new and different. If the system does not allow its own browser, I dare say that IE's share will be even smaller.
If the id and name are the same, he will also be returned
//Dynamicly add Element, all browsers can implement it var newnode=document.createElement("input"); newnode.type="button"; newnode.value="sixth "; //This can also be achieved in IE var newnode= document.createElement("");
15: When shielding the right click, Firefox is different from others in the oncontextmenu event.
16: When adding style and script dynamically, IE is different from other browsers. Check specifically.
17: For DOM2 and DOM3, the situation is more complicated.
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn