搜索框

简介: 搜索框实列 Title .gg{ color:#dddddd; (浅灰色) } .

搜索框实列

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
             .gg{
                  color:#dddddd;           (浅灰色)
            }
            .bb{
                  color:black;                  (黑色的字体)
             }
    </style>
</head>
<body>
         <input type="text" class="gg" value="请输入内容" onfocus="Focus(this);" onblur="Blur(this);"/>
<script>
     function Focus(ths){
            //查找第一种方式
            //document
            //第二种方式 (this)
            //ths
            ths.className = "bb";
            var current_val = ths.value;
            if(current_val == "请输入内容"){
                ths.value = ""
            }
      }
      function Blur(ths){
            var current_val = ths.value;
            if(current_val == "请输入内容" || current_val.trim().length == 0){
                   ths.value = "请输入内容";
                   ths.className == "gg";
             }
       }
</script>
</body>
View Code

 

相关文章
|
6月前
|
JavaScript 前端开发 Java
67jqGrid - 搜索操作工具栏
67jqGrid - 搜索操作工具栏
27 0
|
4月前
ActionChains方法列表(selenium模拟鼠标点击)
ActionChains方法列表(selenium模拟鼠标点击)
42 0
|
5月前
点击按钮,新增输入框,再点击按钮,删除输入框
点击按钮,新增输入框,再点击按钮,删除输入框
26 0
|
5月前
|
小程序 JavaScript
小程序点击轮播图跳转到tab导航界面
小程序点击轮播图跳转到tab导航界面
46 0
|
Windows
模拟鼠标点击
模拟鼠标点击
164 0
网页鼠标点击特效代码
我在网页的源代码中找到了这个鼠标点击特效代码,贴在下面。
125 0
|
前端开发 开发者
首页-顶部搜索的自适应布局|学习笔记
快速学习 首页-顶部搜索的自适应布局
72 0
|
数据采集 Python
Python爬虫:Selenium鼠标点击二级菜单
Python爬虫:Selenium鼠标点击二级菜单
844 0
|
Web App开发
怎样保持下拉菜单并截图?如何快速截图二级菜单?
怎样保持下拉菜单并截图?如何快速截图二级菜单?
479 0
怎样保持下拉菜单并截图?如何快速截图二级菜单?