window.screen document.body <script type="text/javascript"> function getInfo(){ var s = ""; s += " 网页可见区域宽:"+ document.body.clientWidth+"\n"; s += " 网页可见区域高:"+ document.body.clientHeight+"\n&quo…
js获取屏幕(设备)宽高 <script language="javascript"> var h = ""; h += " 网页可见区域宽:"+ document.body.clientWidth+"\n"; h += " 网页可见区域高:"+ document.body.clientHeight+"\n"; h += " 网页可见区域宽:"+ docu…
<script type=“text/javascript”> function isIE(){return navigator.appName.indexOf(“Microsoft Internet Explorer”)!=-1 && document.all;} function isIE6() {return navigator.userAgent.split(“;”)[1].toLowerCase().indexOf(“msie 6.0″)==“-1″?false:tr…
今天用react写一个页面,需要获取一个img高度设置为auto的高度,可是一直获取到的要么是0,要么是null,因为页面加载完了图片不一定加载完. 当我把高度由 auto 设置为固定值之后,又可以获取到该img的高度.可是我就是不想要固定的高度啊. 于是,度娘之,得到的答案是 var imgHeight=document.getElementById("img").offsetHeight; alert(imgHeight) //或者 var imgHeight=document.g…
var scrollLeft = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft); var scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop); function getInfo() { var s = ""; s += " 网…
平常获取设备的宽高无非就那几 <script language="javascript"> var h = ""; h += " 网页可见区域宽:"+ document.body.clientWidth; h += " 网页可见区域高:"+ document.body.clientHeight; h += " 网页可见区域宽:"+ document.body.offsetWidth +"…