首页 > Web开发 > 详细

js读取/设置元素css

时间:2016-04-25 06:28:06      阅读:192      评论:0      收藏:0      [点我收藏+]
Base.prototype.css = function (attr, value) {
	for (var i = 0; i < this.elements.length; i ++) {
		if (arguments.length == 1) {
				if (typeof window.getComputedStyle != ‘undefined‘) {
				         return window.getComputedStyle(this.elements[i], null)[attr];
				} else if (typeof this.elements[i].currentStyle != ‘undefined‘) {
				         return this.elements[i].currentStyle[attr];
				}
		} else {
		        this.elements[i].style[attr] = value;
		}
	}
	return this;
}

 

js读取/设置元素css

原文:http://www.cnblogs.com/fangxuele/p/5429097.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!