返回到:Prototype – 元素对象
此方法修改元素的 CSS 样式属性。样式作为属性值对的散列传递,其中属性以驼峰形式指定。
语法
element.setStyle(styles);
返回值
返回一个 HTML 元素。
例子
<html>
<head>
<title>Prototype examples</title>
<script type = "text/javascript" src = "/javascript/prototype.js"></script>
<script>
function setColor() {
$('test').setStyle({
backgroundColor: '#900',
fontSize: '12px'
});
}
</script>
</head>
<body">
<p id = "test">Click the button to see the result.</p>
<input type = "button" value = "Click" onclick = "setColor();"/>
</body>
</html>返回到:Prototype – 元素对象
作者:terry,如若转载,请注明出处:https://www.web176.com/prototype_api/9004.html
支付宝
微信