zoukankan      html  css  js  c++  java
  • 搜索框里显示字段鼠标点击后就隐藏的方法

    我们可以看到一些织梦dedecms网站上的搜索框内有默认的字段,但我们鼠标点击后就没有了。

    我也想在我的网站的搜索框内实现这样的效果,于在网上搜寻一番,终于找到实现这一效果的方法。
     
    方法如下:https://www.xuanhe.net
     
    <input name="keyword" id="keyword" type="text" class="searchtxt"  size="20" value="探寻预留字" style="color:#ddd" onfocus="if (this.value=='探寻预留字')this.value=''" onblur="if (this.value=='')this.value='探寻预留字'" />
     
    Quote:
     
    <input name="keyword" id="keyword" type="text" class="searchtxt"  size="20" value="探寻预留字" style="color:#ddd" onfocus="if (this.value=='探寻预留字')this.value=''" onblur="if (this.value=='')this.value='探寻预留字'" />
     
     
    //解释onfocus="if (this.value=='探寻预留字')this.value=''"  当选中INPUT时候如果VALUE中的文字为 探寻预留字,则VALUE="",
     
    //onblur="if (this.value=='')this.value='探寻预留字'"  当焦点失去,如果搜索文本框INPUT 中无任何数据,则value='探寻预留字' 。
  • 相关阅读:
    poj 3617 Best Cow Line
    POJ 1852 Ants
    Pairs
    codility MinAbsSum
    Codeforces Beta Round #67 (Div. 2)C. Modified GCD
    timus 1018. Binary Apple Tree
    C
    HDU 1299Diophantus of Alexandria
    BZOJ2155(?) R集合 (卡特兰数)
    CSP模拟赛 number (二分+数位DP)
  • 原文地址:https://www.cnblogs.com/zqw111/p/13029965.html
Copyright © 2011-2022 走看看