Various methods to implement the prompt function of text box in html

Various methods to implement the prompt function of text box in html
You can use the attribute in HTML5 <input="text" placeholder="what you want to enter" >

You can also use js to add css style

Copy code
The code is as follows:

<style type="text/css">
.in_search {
border:1 none;
color:#999999;
float:left;
font-size:14px;
height:18px;
line-height:18px;
margin:3px 2px;
width:253px;
}
</style>
<input name="q" class="in_search" onfocus="if(this.value=='Please enter what you want to enter'){this.value='';}" onblur="if(this.value==''){this.value='Please enter what you want to enter';}" type="text" value="Please enter what you want to enter"/>

<<:  JavaScript implements the detailed process of stack structure

>>:  An example of vertical centering of sub-elements in div using Flex layout

Recommend

Some understanding of absolute and relative positioning of page elements

From today on, I will regularly organize some smal...

Web Design Teaching or Learning Program

Section Course content Hours 1 Web Design Overvie...

How to implement email alert in zabbix

Implemented according to the online tutorial. zab...

Vue realizes the product magnifying glass effect

This article example shares the specific code of ...

Vue monitoring properties and calculated properties

Table of contents 1. watch monitoring properties ...

Summary of some practical little magic in Vue practice

How can you forget lazy loading of routes that al...

CSS3 realizes text relief effect, engraving effect, flame text

To achieve this effect, you must first know a pro...

Detailed tutorial on installing mysql8.0.22 on Alibaba Cloud centos7

1. Download the MySQL installation package First ...

Summary of common commands for building ZooKeeper3.4 middleware under centos7

1. Download and decompress 1. Introduction to Zoo...

33 ice and snow fonts recommended for download (personal and commercial)

01 Winter Flakes (Individual only) 02 Snowtop Cap...

Solve the problem that await does not work in forEach

1. Introduction A few days ago, I encountered a p...

Detailed Analysis of the Selection of MySQL Common Index and Unique Index

Suppose a user management system where each perso...

JavaScript canvas to achieve mirror image effect

This article shares the specific code for JavaScr...

Vue implements a draggable tree structure diagram

Table of contents Vue recursive component drag ev...