Javascript 如何获得图像真实的css显示属性

Javascript 如何获得图像真实的css显示属性,javascript,html,css,properties,Javascript,Html,Css,Properties,我得到了一段html <img style="cursor: pointer; width: auto; height: auto; display: inline;" src="http://www.kidsgen.com/fables_and_fairytales/images/rapunzel.gif" alt="rapunzel" title="rapunzel" align="right"> 或 它总是给我值块 怎么了?属性分配导致img元素的显示属性设置为“块”。没有a

我得到了一段html

<img style="cursor: pointer; width: auto; height: auto; display: inline;" src="http://www.kidsgen.com/fables_and_fairytales/images/rapunzel.gif" alt="rapunzel" title="rapunzel" align="right">

它总是给我值


怎么了?

属性分配导致img元素的显示属性设置为“块”。没有
align='right'
property的代码将发出“inline”警报


这是因为图像标签中有
align=“right”


该CSS规则用于对齐块元素()。

使用检查器并跟踪样式,可能有一个
display:block!重要信息
我刚刚在firebug中检查了图像样式。没有
display:block这样的样式!重要信息
显示:块
alert($('img:first').css('display'))
var el=document.getElementsByTagName('img')[0]
alert(document.defaultView.getComputedStyle(el,null)['display'])
<body>
    <img style="cursor: pointer; width: auto; height: auto; display: inline;" src="http://www.kidsgen.com/fables_and_fairytales/images/rapunzel.gif" alt="rapunzel" title="rapunzel" />
</body>

alert($('img:first').css('display')); // alerts 'inline'
$('img:first').css('display', 'inline');