Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1
  1. #1
    Junior Member
    Join Date
    Dec 2013
    Posts
    1
    Member #
    38046

    enter key problem

    i am trying to learn how to make a text editor.here i creat a paragraph using "para" button.and inside the paragraph there will be a quote.Every time I press 'enter' within this paragraph, a new paragraph is created, rather than a line break tag (<br>). How can I force a line break tag to be created instead of a paragraph element?also

    i cant even get outside of the quote tag.though designMode is on and contenteditable is true for both paragrap and quote
    Code:
    <head>
    <meta charset="utf-8">
    <title>Untitled Document</title>
    <style>
    *{margin:0px;padding:0px;}
    
    #idContent{
    	background-color:pink;
    }
    div{
    	border:1px solid black;
    }
    </style>
    </head>
    
    <body onLoad="loads();" style="position:relative;">
    <iframe id="idContent" width="600" height="280" contenteditable="true" ></iframe>
    <input type="button" value="para" onClick="para();">
    
    <script>
    function loads(){
    	idContent.document.designMode="On";
    }
    function para(){
    	
        var m=document.createElement("p");
    	
    m.setAttribute('style',"border:1px solid black;height:100px;width:500px;position:relative;background-color:white;");
    m.setAttribute('designMode',"on");
    m.setAttribute('contenteditable',"true");
    	
    	var t=document.createElement("q");
    	t.innerHTML="quote here";
    	t.setAttribute('designMode',"on");
    	t.setAttribute('contenteditable',"true");
    	m.appendChild(t);
    	idContent.document.body.appendChild(m);
    	
    }
    </script>
    </body>
    </html>

  2.  


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Tags for this Thread

All times are GMT -6. The time now is 08:58 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com