Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
<div id="xx" style="bottom:20px;"></div>
我如何获得的底值#xx
#xx
您可以使用
document.getElementById('xx').style.bottom;
你会得到字符串'20px'。
'20px'
如果你想要它作为一个数字,你将不得不解析它:
var nb = parseInt(document.getElementById('xx').style.bottom, 10);
在 jQuery 中:
$('#xx').css('bottom');