3 floor
When you press it, replace it immediately.
V id= "A" contenteditable= "true" style= ' border:1 solid black ' >
In fact, many people have discussed before, the code more methods are too terrible, they can not use the time to study, now help you try, in fact, solve it is very simple:
<p> about Microsoft HTML Edit control Click Enter to insert <p> instead of <br> solution </DIV> <p>
<div style= ' border:1 solid black ' contenteditable= ' true ' > Script-not-processed edit controls </div>
<script>
function a.onkeypress () {
if (event.keycode==13) {
var txtobj=document.selection.createrange ()
txtobj.text== ""? txtobj.text= "\ n":(Document.selection.clear ()) & (txtobj.text= "\ n")//three-mesh compound expression, To resolve the cursor positioning problem when the text is selected
Document.selection.createRange (). Select ()
return False
}}
</script>
4 floor
When you press it, replace it immediately.
V id= "A" contenteditable= "true" style= ' border:1 solid black ' >
In fact, many people have discussed before, the code more methods are too terrible, they can not use the time to study, now help you try, in fact, solve it is very simple:
<p> about Microsoft HTML Edit control Click Enter to insert <p> instead of <br> solution </DIV> <p>
<div style= ' border:1 solid black ' contenteditable= ' true ' > Script-not-processed edit controls </div>
<script>
function a.onkeypress () {
if (event.keycode==13) {
var txtobj=document.selection.createrange ()
txtobj.text== ""? txtobj.text= "\ n":(Document.selection.clear ()) & (txtobj.text= "\ n")//three-mesh compound expression, To resolve the cursor positioning problem when the text is selected
Document.selection.createRange (). Select ()
return False
}}
</script>
5 Floor
When you press it, replace it immediately.
V id= "A" contenteditable= "true" style= ' border:1 solid black ' >
In fact, many people have discussed before, the code more methods are too terrible, they can not use the time to study, now help you try, in fact, solve it is very simple:
<p> about Microsoft HTML Edit control Click Enter to insert <p> instead of <br> solution </DIV> <p>
<div style= ' border:1 solid black ' contenteditable= ' true ' > Script-not-processed edit controls </div>
<script>
function a.onkeypress () {
if (event.keycode==13) {
var txtobj=document.selection.createrange ()
txtobj.text== ""? txtobj.text= "\ n":(Document.selection.clear ()) & (txtobj.text= "\ n")//three-mesh compound expression, To resolve the cursor positioning problem when the text is selected
Document.selection.createRange (). Select ()
return False
}}
</script>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.