获取非行间样式函数
<script type="text/javascript"> window.onload = function() { var som = document.getElementsByTagName('td')[0]; function getStyle(obj, attr,value) { if(!value) { if(obj.currentStyle) { return obj.currentStyle[attr]; } else { return window.getComputedStyle(obj,false)[obj,attr]; } }else{ obj.style[attr] = value } } console.log( getStyle(som,'font-size') ); console.log( getStyle(som,'border') ); console.log( getStyle(som,'color') ); } </script>