Prototype - writeAttribute() 方法
此方法添加、指定或删除作为哈希或名称/值对传递的属性。
语法
element.writeAttribute(attribute[, value]); 或 element.writeAttribute(attributes);
返回值
HTML 元素。
示例
<html>
<head>
<title>Prototype examples</title>
<script type = "text/javascript" src = "/javascript/prototype.js"></script>
<script>
function showResult() {
$('test').writeAttribute("align", "right" );
}
</script>
</head>
<body>
<p id = "test" align = "center" >Formatted Paragraph</p>
<br />
<input type = "button" value = "Click" onclick = "showResult();"/>
</body>
</html>

prototype_element_object.html