search
HomeWeb Front-endHTML TutorialUnderline the text in the text box_html/css_WEB-ITnose

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>


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>

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
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
The Future of HTML: Evolution and Trends in Web DesignThe Future of HTML: Evolution and Trends in Web DesignApr 17, 2025 am 12:12 AM

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML vs. CSS vs. JavaScript: A Comparative OverviewHTML vs. CSS vs. JavaScript: A Comparative OverviewApr 16, 2025 am 12:04 AM

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML: Is It a Programming Language or Something Else?HTML: Is It a Programming Language or Something Else?Apr 15, 2025 am 12:13 AM

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML: Building the Structure of Web PagesHTML: Building the Structure of Web PagesApr 14, 2025 am 12:14 AM

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

From Text to Websites: The Power of HTMLFrom Text to Websites: The Power of HTMLApr 13, 2025 am 12:07 AM

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

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

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

The Role of HTML: Structuring Web ContentThe Role of HTML: Structuring Web ContentApr 11, 2025 am 12:12 AM

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.

HTML and Code: A Closer Look at the TerminologyHTML and Code: A Closer Look at the TerminologyApr 10, 2025 am 09:28 AM

HTMLisaspecifictypeofcodefocusedonstructuringwebcontent,while"code"broadlyincludeslanguageslikeJavaScriptandPythonforfunctionality.1)HTMLdefineswebpagestructureusingtags.2)"Code"encompassesawiderrangeoflanguagesforlogicandinteract

See all articles

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft