zoukankan      html  css  js  c++  java
  • jQuery练习7焦点失去样式

     1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
     2 <html>
     3   <head>
     4     <meta http-equiv="content-type" content="text/html; charset=UTF-8">
     5     <style type="text/css">
     6         .myClass{
     7             color:#c0c0c0
     8         }
     9     </style>
    10       <script type="text/javascript" src="../js/jquery-1.9.1.js"></script>
    11   </head>
    12   <body>
    13     <table border="1" align="center">
    14         <tr>
    15             <th>用户名</th>
    16             <td>
    17                 <input type="text" value="输入用户名"/>
    18             </td>
    19         </tr>
    20     </table>
    21     <script type="text/javascript">
    22         //为input元素添加样式
    23         $("input").first().addClass("myClass");
    24         //为input元素添加事件
    25         $("input").first().focus(function(){
    26             //清空原文本框中的值
    27             $(this).val("");
    28             //删除原样式
    29             $(this).removeClass("myClass");
    30         });
    31     </script>    
    32   </body>
    33 </html>
  • 相关阅读:
    HTML介绍
    python D41 前端初识
    mysql索引原理与查询优化
    python D41
    python D40 pymsql和navicat
    python D40 以及多表查询
    python D35 selectors模块
    python D35 I/O阻塞模型
    测试过程
    测试基础
  • 原文地址:https://www.cnblogs.com/hacket/p/3071916.html
Copyright © 2011-2022 走看看