Home > Web Front-end > JS Tutorial > Replace the carriage return and line feed contained in the string in the textarea with the javascript code of <br>_Form special effects

Replace the carriage return and line feed contained in the string in the textarea with the javascript code of <br>_Form special effects

WBOY
Release: 2016-05-16 19:14:54
Original
1422 people have browsed it

1st Floor
textarea.value.replace(/n/g, "
");
2nd Floor
s=textarea.value.replace(/rn/g, "
") ;

3rd Floor
Change immediately when pressed
V ID="a" contentEditable="true" style='border:1 solid black'>
In fact, there were many before People have discussed that there are too many code methods that are too scary. If you don’t use them, you don’t have time to study them. Now I’ve tried it for you. In fact, the solution is very simple:)

About Microsoft HTML Edit Control Click back Solution where the car will insert

instead of


Unscripted edit control



4th Floor
Change immediately when pressed
V ID="a" contentEditable="true" style='border:1 solid black'>
In fact, many people have discussed it before. It is too scary to have too many code methods. If you don’t use it, you don’t have time to research it. Now I’ll try it for you. In fact, the solution is very simple:)  

 

Regarding the Microsoft HTML editing control, clicking Enter will insert
instead of Solution


Unscripted editing control



5th Floor
Replace immediately when pressed
V ID= "a" contentEditable="true" style='border:1 solid black'>

In fact, many people have discussed it before. It is too scary to have too many methods in the code. If you don't use it yourself, you won't have time to study it. Now I will help you. I tried it, and the solution is actually very simple:)


About the solution that Microsoft HTML editing control inserts instead of

when clicking Enter


Unscripted editing controls
<script> <BR> function a.onkeypress(){ <BR> if(event.keyCode==13){ <BR> var txtobj=document.selection.createRange() <BR> txtobj.text==""?txtobj.text="\n":(document.selection.clear())&(txtobj.text="\n") //三目复合表达式,解决有被选文字时回车的光标定位问题 <BR> document.selection.createRange().select() <BR> return false <BR> }} <BR> </script> <script> <BR> function a.onkeypress(){ <BR> if(event.keyCode==13){ <BR> var txtobj=document.selection.createRange() <BR> txtobj.text==""?txtobj.text="\n":(document.selection.clear())&(txtobj.text="\n") //三目复合表达式,解决有被选文字时回车的光标定位问题 <BR> document.selection.createRange().select() <BR> return false <BR> }} <BR> </script> <script> <BR> function a.onkeypress(){ <BR> if(event.keyCode==13){ <BR> var txtobj=document.selection.createRange() <BR> txtobj.text==""?txtobj.text="\n":(document.selection.clear())&(txtobj.text="\n") //三目复合表达式,解决有被选文字时回车的光标定位问题 <BR> document.selection.createRange().select() <BR> return false <BR> }} <BR> </script>
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