获取非行间样式:
<!DOCTYPE html>
<html lang=<span style="color: #800000;">"</span><span style="color: #800000;">en</span><span style="color: #800000;">"</span>>
<head>
<meta charset=<span style="color: #800000;">"</span><span style="color: #800000;">UTF-8</span><span style="color: #800000;">"</span>>
<title>获取非行间样式</title>
<style><span style="color: #000000;">
#div1{height: 200px;width: 200px;background</span>-<span style="color: #000000;">color: red;}
</span></style>
<script><span style="color: #000000;">
function getStyle(obj,name){
</span><span style="color: #0000ff;">if</span><span style="color: #000000;">(obj.currentStyle){
</span><span style="color: #0000ff;">return</span><span style="color: #000000;"> obj.currentStyle[name]; //IE浏览器
}
</span><span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span><span style="color: #000000;">(getComputedStyle){ //Firefox,chrome浏览器
</span><span style="color: #0000ff;">return</span> getComputedStyle(obj,<span style="color: #0000ff;">null</span><span style="color: #000000;">)[name];
}
}
window.onload </span>=<span style="color: #000000;"> function(){
</span><span style="color: #0000ff;">var</span> oDiv = document.getElementById(<span style="color: #800000;">'</span><span style="color: #800000;">div1</span><span style="color: #800000;">'</span><span style="color: #000000;">);
alert(getStyle(oDiv,</span><span style="color: #800000;">'</span><span style="color: #800000;">height</span><span style="color: #800000;">'</span><span style="color: #000000;">));
}
</span></script>
</head>
<body>
<div id=<span style="color: #800000;">"</span><span style="color: #800000;">div1</span><span style="color: #800000;">"</span>></div>
</body>
</html>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号