如果不在某元素上添加类似的样式:style="font-size:20px;",在不同浏览器上获取样式的属性值的方式:


		function test(){
		
			var x = document.getElementById("t1");
			//判断打开的哪个浏览器
			if(x.currentStyle){//ie
				var size = x.currentStyle['fontSize'];
				alert(size);
			}else if(window.getComputedStyle){//ff Google...
				var size= window.getComputedStyle(x,null)['fontSize'];
				alert(size);
			}

		}

动态添加的样式:


		#t1{
			font-size:20px;
			color:#ffff00;
		}

body部分的测试:


test