Table of Contents
Reply to discussion (solution)
Home Web Front-end HTML Tutorial Underline the text in the text box_html/css_WEB-ITnose

Underline the text in the text box_html/css_WEB-ITnose

Jun 24, 2016 pm 12:24 PM

The text in the text box is underlined,
Rendering:

Each name is underlined and semicoloned. When deleting, it is deleted by each name instead of character by character. .
How to implement it, thank you! !


Reply to discussion (solution)

I saw the use of ?? in the recipient text box of the ??? box, and ???Chinese characters? can? Exit ?, use ?? to display some information

That should be it! The same goes for when we delete things in other files!

Can’t you use CSS to achieve the underline? Just keep the price underline.
See here for details http://www.docin.com/p-56329239.html

As for when you said deleting, deleting by name, not deleting character by character, I don’t know what you mean specifically. .
I don’t know what your specific deletion method is and what kind of circumstances it will be deleted. This is still simple. The problem is to figure out what
should be deleted under what circumstances.

If the name above is your username, you can delete it in many ways. For example, you can replace the specified name with a null character.

This post was last edited by net_lover on 2011-10-10 11:32:12

I saw the use of ?? in the recipient text box of the ??? box, and ???Chinese characters can be used to display ?, and ?? can be used to display some information
Have you studied its code?

You can really see how the code is implemented

Style can solve it

CSS underline

It’s more difficult

Can't you realize the underline using CSS? Just keep the price underline.
See here for details http://www.docin.com/p-56329239.html

As for when you said deleting, deleting by name, not deleting character by character, I don’t know what you mean specifically. .
I don’t know what your specific deletion method is and what kind of circumstances it will be deleted. This is still simple. The problem is to figure out what
should be deleted under what circumstances.
The underline style is to underline all the text in the text box. I underline each name.
As for deletion, it is to delete according to each user name, such as: Zhang San, when deleting It was deleted once, not twice. Do you understand what I said?

Similar to the text box of the recipient of the email sent by QQ

In fact, I have done this (ok It’s a small DEMO, nothing to mess around with). In fact, this thing is not a textbox
but countless DIVs

http://blog.csdn.net/cj205/article/details/6277208

If you want to add styles, there is no problem at all.

Middle name Controlling the style of a will have a underline. . .

Of course, deletion means deleting this a.

Implemented with css. . .

It is not difficult to add an underline to the text box. Just add styles with css:

<html><body><input type="text" id="t1" style="text-decoration: underline;"/></body></html>
Copy after login


But it is more troublesome to add a semicolon to separate it. The method is as follows in Outlook emails After pressing Enter, check the user name in the address book. If you want to implement it on the web, you also need to trigger the event after pressing Enter, write some js, access the background through ajax, match the user name, and operate the text box data to meet this requirement.

Apply what you have learned

Some minor troubles

It is not a text box, you can consider using a div to simulate it. There are countless small spans or divs inside.

Define with style files, basic html functions

Use span to style

Well, you can

Simple implementation method
You can do more functions by yourself Add

<script>function delSelect(v){evt = v||window.event;	if(evt.keyCode.toString()!="8" && evt.keyCode.toString()!="46"){if(window.event){window.event.returnValue=false;window.event.cancelBubble=true;return false;}else{evt.preventDefault();}return false;}ele = window.event?window.event.srcElement:v.target;while(ele.nodeType!=1) ele = ele.parentNode;while(ele.tagName!="DIV"){ele = ele.parentNode;}ele.parentNode.removeChild(ele)}</script><body><div style="border:1px solid gray;height:26px"><div style="float:left;text-outline:none" unselectable="on" contentEditable=true onkeydown="delSelect(event)"><span style="border-bottom:1px solid red">xxx;</span> </div><div style="float:left;text-outline:none" unselectable="on" contentEditable=true onkeydown="delSelect(event)"><span style="border-bottom:1px solid red">yyyy;</span></div> <div style="clear:both"></div></div>
Copy after login

Thank you for your replies,
In fact, I just want to implement a recipient text box similar to QQ or 163 when sending emails

Haha Haha

Follow.

Has anyone done it?
Thank you! ! ! ! ! ! ! ! ! ! !

If you want the effect of a certain website, I suggest you carefully study their source code. The website you mentioned may not be used by others

Firebug and yslow are both good tools for viewing code

The 12th floor has provided you with an example

Use a hidden input box, and then enter the content and display it in the DIV

Take the points and leave haha

Gone with the wind Pass~~~~

Try to store a hyperlink into an array and read it, or capture whether the keyboard key pressed is the backspace key when deleting. You can delete a value in the array, or backspace. When pressing the grid key, you can judge the character before the last ";" and delete it. It is probably like this. It just provides an idea. You have to rely on yourself for the details.


It seems quite complicated. You should use div to simulate it.

I watched it, I watched it, and I learned something.

Thank you everyone for your replies! ! ! ! ! ! ! I have an idea, I hope I can solve it.

Okay, okay

Realize it with css

Get points, roar

Just look at the source code

To be honest, it’s a bit painful

Try to store a hyperlink into an array and read it, or when deleting, capture whether the key pressed is the backspace key. You can delete a value of the array, or when it is the backspace key, you can determine the last value. Delete the character before ";", it's probably like this, it just provides an idea, you still have to rely on your own
The idea is fine

Oh, that's it!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Is HTML easy to learn for beginners? Is HTML easy to learn for beginners? Apr 07, 2025 am 12:11 AM

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

The Roles of HTML, CSS, and JavaScript: Core Responsibilities The Roles of HTML, CSS, and JavaScript: Core Responsibilities Apr 08, 2025 pm 07:05 PM

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

Understanding HTML, CSS, and JavaScript: A Beginner's Guide Understanding HTML, CSS, and JavaScript: A Beginner's Guide Apr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Apr 04, 2025 pm 11:54 PM

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

What is an example of a starting tag in HTML? What is an example of a starting tag in HTML? Apr 06, 2025 am 12:04 AM

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

How to use CSS3 and JavaScript to achieve the effect of scattering and enlarging the surrounding pictures after clicking? How to use CSS3 and JavaScript to achieve the effect of scattering and enlarging the surrounding pictures after clicking? Apr 05, 2025 am 06:15 AM

To achieve the effect of scattering and enlarging the surrounding images after clicking on the image, many web designs need to achieve an interactive effect: click on a certain image to make the surrounding...

HTML, CSS, and JavaScript: Essential Tools for Web Developers HTML, CSS, and JavaScript: Essential Tools for Web Developers Apr 09, 2025 am 12:12 AM

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

How to implement adaptive layout of Y-axis position in web annotation? How to implement adaptive layout of Y-axis position in web annotation? Apr 04, 2025 pm 11:30 PM

The Y-axis position adaptive algorithm for web annotation function This article will explore how to implement annotation functions similar to Word documents, especially how to deal with the interval between annotations...

See all articles