分享

通过style的方式直接改变样式

 qiu977 2013-01-04

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www./TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www./1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>通过style改变局部的样式</title>
<script type="text/javascript">
 function red(){
 //backgroundColor中的color要大写 
 document.getElementById("button").style.height="200px"
 document.getElementById("button").style.backgroundColor="red"
 }
</script>
</head>


<body>
<input id="button" type="button" value="点击改变" onclick="red()"/>
</body>
</html>

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多