zoukankan      html  css  js  c++  java
  • 给指定的元素添加样式

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-1.12.1.js" type="text/javascript"></script>
    <script type="text/javascript">
    function testCss(){
    //设置元素的属性值 主要是css
    //设置单个属性 其实就是操作的style属性
    $("h1").css("color","red").css("cursor","pointer");
    //对象的方式去设置 background-color backgroundColor
    $("h1").css({
    "color":"green",
    cursor:"pointer",
    //"background-color":"yellow",
    backgroundColor:"red"

    });
    }

    </script>
    </head>
    <body>
    <input type="button" value="mod" onclick="testCss()">
    <hr>
    <h1>this is a h1</h1>
    </body>
    </html>

  • 相关阅读:
    问题6-10
    7.19 1
    经济学人常见词汇清单
    英语广播原声听力100篇MP3及听力原文
    6.30.2018
    6.26
    6.26
    6.26
    6.25
    6.25
  • 原文地址:https://www.cnblogs.com/hwgok/p/5901506.html
Copyright © 2011-2022 走看看