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

WBOY
Release: 2016-06-24 12:24:44
Original
2586 people have browsed it

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!

source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template