zoukankan      html  css  js  c++  java
  • jquery练习

    第四章

    实现鼠标经过字体变白吗,背景变蓝的效果,鼠标离开,恢复原来的样式。

    <!DOCTYPE html>
    <html>
      <head>
        <title>Unit.html</title>
        <style type="text/css">
        .a{
            background: blue;
            color: white;
        }
        </style>
        <script type="text/javascript" src="../js/jquery-3.3.1.js"></script>
        <script type="text/javascript">
            $(function(){
                $("li").mouseover(function(){
                    $(this).addClass("a");
                });
                $("li").mouseleave(function(){
                    $(this).removeClass("a");
                });
                
            });
        </script>
      </head>
      
      <body>
        新手上路:
        <ul>
            <li>标题一</li>
            <li>标题一</li>
            <li>标题一</li>
            <li>标题一</li>
            <li>标题一</li>
        </ul>
      </body>
    </html> 

    输入提示效果

    <!DOCTYPE html>
    <html>
      <head>
        <title>test1.html</title>
        <script type="text/javascript" src="../js/jquery-3.3.1.js"></script>
        <script type="text/javascript">
        $(function(){
            $("#username").click(function(){
                $(this).val("");
            });
            $("#password").click(function(){
                $(this).val("");
            });
        });
        
        </script>
      </head>
      
      <body>
        <from>
            用户名:<input type="text" value="用户名" style="color:gray;" id="username"><br><br>
            密码:<input type="text" value="密码" style="color:gray;" id="password"><br><br>
            <input type="submit" type="login">
        </from>
    
      </body>
    </html>
  • 相关阅读:
    Java集合——Map接口
    Django 创建一个返回当前时间的页面
    python 练习 后台返回当前时间
    python 练习 simple_server 判断路径及返回函数
    通过 docker 来搭建 Jenkins
    Bitbucket 触发内网 Jenkins Build
    jQuery 扩展方法
    HTML 练习滑动
    HTML 练习淡入淡出
    HTML 练习显示隐藏
  • 原文地址:https://www.cnblogs.com/excellencesy/p/8776467.html
Copyright © 2011-2022 走看看