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='探寻预留字' 。
  • 相关阅读:
    PHP
    linux文件分割(将大的日志文件分割成小的)
    centos安装ssdb
    SSDB 数据库如何换用 rocksdb 引擎?
    A PHP extension for Facebook's RocksDB
    看电影有感
    视频格式(转的豆瓣)
    7月7号项目讲解总结
    java注解Annotation
    xml的解析
  • 原文地址:https://www.cnblogs.com/zqw111/p/13029965.html
Copyright © 2011-2022 走看看