获取内联和链接中的样式(js代码)

 
var head = document.getElementById( "box" );
// alert( head.style.background )
// alert( head.style.cssFloat || head.style.styleFloat ) // 获取float不一样
// head.style.fontSize = "30px"
head.style.color = "#f00";
// (typeof head.style.cssFloat != "undefined" ) ? head.style.cssFloat = "right" : head.style.styleFloat = "right" 跨浏览器设置float
// var style = ( window.getComputedStyle ? window.getComputedStyle( head,null ) : null ) || head.currentStyle; 跨浏览器获取计算之后的样式
// alert( style.fontSize )
// 这样可以获取到内联和链接
// 因为计算之后的样式会驻留在浏览器的计算样式里面 所以就可以获取得到