zoukankan      html  css  js  c++  java
  • jQuery实现变色

    <title></title>

    <script src="jquery-1.9.1.js" type="text/javascript"></script>
    <script type="text/javascript">
    function backgorundColor(i) {
    // this.document.body.style.backgroundColor = i;
    // this.document.getElementById('div1').style.backgroundColor= i;
    this.document.getElementsByName('div').item[0].style.backgroundColor = i;
    }

    function changeColor() {
    var a = document.getElementsByName('color');
    for (var i = 0; i < a.length; i++) {
    if (allradio[i].checked == true) {
    document.body.style.backgroundColor = a[i].value;
    }
    }
    }

    // $(function () {
    // $('input').click(function () {
    // $('body').css('background-color',$(this).attr('value'));
    // })
    // })
    </script>
    </head>
    <body>
    <div id="div1" style="200px;height:200px;"></div>

    <input id="Radio1" type="radio" value="Red" name="color" onclick="backgorundColor('Red')" /> 红色
    <input id="Radio2" type="radio" value="Blue" name="color" onclick="backgorundColor('Blue')" />蓝色
    <input id="Radio3" type="radio" value="Green" name="color" onclick="backgorundColor('Green')" />绿色
    <input id="Radio4" type="radio" value="Orange" name="color" onclick="backgorundColor('Orange')" />橙色
    </body>

  • 相关阅读:
    13-计算属性和侦听器
    12-指令系统介绍
    11-vue的使用
    10-vue的介绍
    09-babel
    08-webpack的介绍
    07-nodejs中npm的使用
    06-Nodejs介绍
    05-面向对象
    Docker结合Jenkins构建持续集成环境
  • 原文地址:https://www.cnblogs.com/qiqiBoKe/p/3036682.html
Copyright © 2011-2022 走看看