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

Installation and use of mysql on Ubuntu (general version)

Regardless of which version of Ubuntu, installing...

Pygame code to make a snake game

Table of contents Pygame functions used Creating ...

Simple use of Vue vee-validate plug-in

Table of contents 1. Installation 2. Import 3. De...

Summary of principles for writing HTML pages for emails

Since HTML email is not an independent HOST page o...

canvas.toDataURL image/png error handling method recommendation

Problem background: There is a requirement to tak...

5 Tips for Protecting Your MySQL Data Warehouse

Aggregating data from various sources allows the ...

Implementation of breakpoint resume in vue-video-player

In a recent project, I needed to implement the fu...

Jenkins Docker static agent node build process

A static node is fixed on a machine and is starte...

Problems and solutions of using TweenMax animation library in angular

I have nothing to do recently, so I tinker with C...

Javascript to achieve drumming effect

This article shares the specific code of Javascri...

Debian virtual machine created by VirtualBox shares files with Windows host

the term: 1. VM: Virtual Machine step: 1. Downloa...

Detailed example of using typescript to encapsulate axios in Vue3

This axios package is used in the vue3 demo. For ...