zoukankan      html  css  js  c++  java
  • js自动判断标题应当填何值

    <!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>js自动判断标题应当填何值</title>
    </head>

    <body>
    标题:<input id=
    "title" name="title" value=""/>
    <script>
    function bindTitleEvent(){
         var TITLE =
    "请填写相关标题内容";
    var el = document.getElementById('title');
    if (!el) return;
    el.value = TITLE;
    el.onfocus = function(){
    if (el.value == TITLE) el.value = '';
    }
    el.onblur = function(){
    if (el.value == '') el.value = TITLE;
    }
    }
    bindTitleEvent();
    </script>
    </body>
    </html>

    查看效果
    ]查看效果[/url]/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>js自动判断标题应当填何值</title>
    </head>

    <body>
    标题:<input id="title" name="title" value=""/>
    <script>
    function bindTitleEvent(){
         var TITLE = "请填写相关标题内容";
    var el = document.getElementById('title');
    if (!el) return;
    el.value = TITLE;
    el.onfocus = function(){
    if (el.value == TITLE) el.value = '';
    }
    el.onblur = function(){
    if (el.value == '') el.value = TITLE;
    }
    }
    bindTitleEvent();
    </script>
    </body>
    </html>
    查看效果
  • 相关阅读:
    牛客网分糖果
    【bzoj3717】[PA2014]Pakowanie 状压dp
    【bzoj1042】[HAOI2008]硬币购物 背包dp+容斥原理
    [POI2007]堆积木Klo
    【bzoj5018】[Snoi2017]英雄联盟 背包dp
    BZOJ 1492 [NOI2007]
    bzoj 2741 [FOTILE模拟赛] L
    bzoj 1486 最小圈
    计数
    cf 700
  • 原文地址:https://www.cnblogs.com/liufei88866/p/1520468.html
Copyright © 2011-2022 走看看