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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Jqery库练习</title>
    <script type="text/javascript" src="jquery-1.7.1.min.js"></script>
    <script>
    $(document).ready(function(e) {
        $("button").click(function(){
            $("p").css("background-color","red");
            });
    });
    $(document).ready(function(e) {
        $("p#id1").click(function(){
            $(this).hide();
            });
    });
    $(document).ready(function(e) {
        $("p.class1").click(function(){
            $(this).hide("slow");    
            });
    });
    </script>
    </head>
    
    <body>
    <p id="id1">实现点击P标签出现隐藏的效果</p>
    <p class="class1">我是一个兵,爱老百姓!</p>
    <button type="button">点击一下</button>
    </body>
    </html>
    <!DOCTYPE html>
    <html>
    <head>
    <script src="/jquery/jquery-1.11.1.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
      $("button").click(function(){
      $("p").toggle();  //通过 jQuery,使用 toggle() 方法来切换 hide() 和 show() 方法。
      });
    });
    </script>
    </head>
    <body>
    <button type="button">切换</button>
    <p>这是一个段落。</p>
    <p>这是另一个段落。</p>
    </body>
    </html>
  • 相关阅读:
    Java-GZIPOutputStream踩坑
    Redis事务
    Netty实现简单群聊
    SpringMVC请求参数解析
    Netty实现WebSocket
    SpringBoot项目war包部署
    NIO实现群聊
    SpringMVC请求映射handler源码解读
    SpringMVC自定义兼容性HandlerMapping
    spring boot自定义类配置绑定在配置文件中自动提示
  • 原文地址:https://www.cnblogs.com/kangshuai/p/4844402.html
Copyright © 2011-2022 走看看