改变颜色大小

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>Document</title>
<style>
*{margin:0;padding:0;}

box{height:100px;width:100px;background:skyblue;}

big_box{height:100%;width:100%;background:rgba(0,0,0,0.1);position:fixed;top:0;left:0;display:none;}

small_box{position:absolute;height:150px;width:280px;top:50%;left:50%;margin-left:-140px;margin-top:-75px;background:white;cursor:pointer}

p1 span{height:20px;width:30px;display:inline-block}

small_box p{height:40px;line-height:40px;}

small_box p font{margin-left:25px;}

small_box p span{margin-left:15px;}

small_box{padding:15px;border:1px solid red}

wan{margin-left:45%;margin-top:15px;}

</style>
<script type="text/javascript">
window.onload=function()
{

     var oBtn = document.getElementById('btn')
     var oBig = document.getElementById('big_box')
     var oWan = document.getElementById('wan')
     var oSpan = document.getElementsByTagName('span')
     var oBox = document.getElementById('box')
     oBtn.onclick = function(){oBig.style.display = "block"}
     oWan.onclick = function(){oBig.style.display = "none"}
    oSpan[0].onclick = function(){oBox.style.background= this.style.background;}
    oSpan[1].onclick = function(){oBox.style.background= this.style.background;}
    oSpan[2].onclick = function(){oBox.style.background= this.style.background;}
 
    oSpan[3].onclick = function(){oBox.style.width = this.innerHTML}
    oSpan[4].onclick = function(){oBox.style.width = this.innerHTML}
    oSpan[5].onclick = function(){oBox.style.width = this.innerHTML}

    oSpan[6].onclick = function(){oBox.style.height = this.innerHTML}
    oSpan[7].onclick = function(){oBox.style.height = this.innerHTML}
    oSpan[8].onclick = function(){oBox.style.height = this.innerHTML}
 }

</script>

</head>
<body>
<div id="box"></div>
<button id="btn">click</button>

<div id="big_box">
<div id="small_box">
<p id="p1">
<font>颜色:</font>
<span style="background:red"></span>
<span style="background:blue"></span>
<span style="background:green"></span>
</p>

 <p id="p2">
      <font>宽度:</font>
      <span>250px</span>
      <span>500px</span>
      <span>750px</span>
 </p>

 <p id="p3">
      <font>高度:</font>
      <span>250px</span>
      <span>500px</span>
      <span>750px</span>
 </p>
 <button id="wan">完成</button>

</div>
</div>

</body>
</html>

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1. tab列表折叠效果 html: 能源系统事业部 岗位名称: 工作地点 岗位名...
    lilyping阅读 5,876评论 0 1
  • jQuery基础 什么是JQ?一个优秀的JS库,大型开发必备JQ的好处?一简化JS的复杂操作二不再需要关心兼容性三...
    幺七阅读 4,455评论 0 2
  • 打开那只爆屏的国产手机,输入:如何挽回前男友,弹出了各式各样的干货…其实这些内容我都快背了出来,来来回回无非也就是...
    嘉玲BB阅读 1,943评论 0 0
  • 感赏昨天那么晚了还是做了老公爱吃的糖水黄桃和肉丸,老公回家一句好香心里美滋滋的。这样我今天不在家他自己也能搞定...
    不一样的我和你阅读 1,462评论 0 0
  • 你走了 留给我一瓶小小的绿萝 在我面前伸展枝叶 也悄悄地把根 蜿蜒在圆圆的瓶底 细细的绒毛在水里呼吸 浅浅的脉络在...
    箬薏阅读 2,920评论 6 8