增加 CSS Class

2015-02-25 22:55:05  访问(2512) 赞(0) 踩(0)

  • <!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=gb2312" />
        <title>增加 CSS Class</title>
    
        <script type="text/javascript" language="javascript" src="<%=jQuery%>"></script>
    
        <script type="text/javascript" language="javascript">
            function buttonClick()
            {
    
                $("#cssrain").addClass("css_a");
                //$("p").removeClass("test"); 
            }
        </script>
    
        <%=VersionHideInfo%>
        <style>
            .css_a
            {
                color: red;
            }
        </style>
    </head>
    <body>
        <div id="cssrain">
            $(document)是获取整个网页文档对象,$("p")是获取所有的段落标签</div>
            
            <br />
            <input type="button" value="点击设置div的内容加上class样式(红色)" onclick="buttonClick()" />
    </body>
    </html>
    
    


上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)