zoukankan      html  css  js  c++  java
  • 表单事件,onblur,onfocus,焦点

     1 <!DOCTYPE html>
     2 <html xmlns="http://www.w3.org/1999/xhtml">
     3 <head>
     4     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     5     <title>表单事件</title>
     6     <script type="text/javascript">
     7         //表单焦点失去、获得
     8         onload = function () {
     9             var txt = document.getElementById("txt");
    10             txt.onblur = function () {
    11                 if (txt.value == "") {
    12                     txt.value = "如123abc@163.com";
    13                 }
    14             }
    15             txt.onfocus = function () {
    16                 if (txt.value == "如123abc@163.com") {
    17                     txt.value = "";
    18                 }
    19             }
    20         }
    21     </script>
    22 </head>
    23 <body>
    24     <form id="fm">
    25         <!--有时提交会出现405错误,可能与name,value,id有关-->
    26         <input type="text" name="uid" value="" id="txt" /><br />
    27         <input type="password" name="pwd" value="" /><br />
    28         <input type="submit" value="提交" id="btn1" /><br />
    29     </form>
    30 
    31 </body>
    32 </html>
  • 相关阅读:
    点分治 (等级排) codeforces 321C
    树上点分治 poj 1741
    判断点在直线的左侧还是右侧
    树的重心
    链式前向星
    树上点的分治
    构造 素数
    二进制 + 模拟
    枚举 + 三分 (游标)
    枚举 + 三分
  • 原文地址:https://www.cnblogs.com/Jacklovely/p/5394448.html
Copyright © 2011-2022 走看看