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

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

    我也想在我的网站的搜索框内实现这样的效果,于在网上搜寻一番,终于找到实现这一效果的方法。
     
    方法如下:
     
    <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='探寻预留字' 。
  • 相关阅读:
    【Linux】ZeroMQ 在 centos下的安装
    ZeroMQ下载、编译和使用
    在Linux系统上安装Git
    Linux下python2.7安装pip
    [Tyvj1474]打鼹鼠
    [BZOJ2908]又是nand
    [SPOJ375]Qtree
    浅谈算法——树链剖分
    [BZOJ5368/Pkusc2018]真实排名
    [FJOI2007]轮状病毒
  • 原文地址:https://www.cnblogs.com/zqw111/p/12985972.html
Copyright © 2011-2022 走看看