从css样式表中抽取元素尺寸_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:48:19
Original
1007 people have browsed it

jS从样式表取值的函数,IE中以currentStyle,firefox中defaultView来获取

DOM.style只能读到写在html中的样式值

获取样式值的函数

function returnStyle(obj,styleName){var myObj = typeof obj =="string" ? document.getElementById(obj) : obj;if(document.all){return eval("myObj.currentStyle."+ styleName);} else {returneval("document.defaultView.getComputedStyle(myObj,null)." +styleName);}}
Copy after login


source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!