<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
#div3{
    width:200px;
    height:200px;
    background:#FF0;
    }
</style>
<script>
function setColor(name,value)
{
    var oDiv=document.getElementById('div3');
    oDiv.style[name]=value;
}
</script>
</head>

<body>

<input type="button" value="变宽"  onclick="setColor('width','500px')"   />
<input type="button" value="变高"  onclick="setColor('height','500px')"/>
<input type="button"  value="变颜色"  onclick="setColor('background','green')"/>
<div id="div3"></div>
</body>
</html>

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-03
  • 2022-12-23
  • 2021-08-25
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-18
  • 2022-12-23
  • 2022-12-23
  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
相关资源
相似解决方案