zoukankan      html  css  js  c++  java
  • jQuery设置页面样式

    <!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>
        <title></title>
        <style type="text/css">
        p
        {
            background-color:#eee; font-size:30px;
            }
            .classadd
            {
                font-weight:bold; font-family:微软雅黑; font-size:40px; background-color:Green;
                }
                .classadd1
                {
                    background-color:Red;
                    }
        </style>
        <script src="jquery-1.9.1.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(function () {
                $('#btnclass').click(function () {
                    $('p').css('background-color', 'blue');//设置样式
                })
                $('#btnAdd').click(function () {
                    $('p').addClass('classadd classadd1');//添加样式
                })
                $('#btnRemove').click(function () {
                    $('p').removeClass('classadd1'); //删除指定名称的样式
                })
                $('#btnChange').click(function () {
                    $('p').toggleClass('classadd1');
                })
            })
        </script>
    </head>
    <body>
    <p class="classadd">得用汉字</p>
    <input type="button" id="btnclass" value="设置样式" />
    <input type="button" id="btnAdd" value="添加样式" />
    <input type="button" id="btnRemove" value="删除样式" />
    <input type="button" id="btnChange" value="切换样式" />
    </body>
    </html>

  • 相关阅读:
    zoj 2001 Adding Reversed Numbers
    hdu 2391 Filthy Rich (简单dp)
    hdu 1128 (hash)
    华为交换机有关BGP的相关配置
    Cent os 6.8添加中文字体
    Liunx之始
    自己鼓励自己
    UML用例图中包含(include)、扩展(extend)和泛化(generalization)三种关系详解(转载)
    20091125心情感觉还不错
    DataTable 行列转换
  • 原文地址:https://www.cnblogs.com/duanlinlin/p/3029149.html
Copyright © 2011-2022 走看看