Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    922
    Thanks
    302
    Thanked 3 Times in 3 Posts

    Exclamation Rich Text Box Code

    I am very sory if I posted in the wrong section, I didnt knew where to post this so I thought this would be the best section to post my question.

    Well, I am in need of a code for RICH TEXT BOX, just same as where I am typing this.....



    If you are not getting wot I want, herez a screenshot



  • #2
    New Coder
    Join Date
    Jun 2006
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile mmm

    Well... this is something you can easily google, but, if you want a VERY BASIC example of how to achieve this, i've got an example on my blog, this will just get you started to create your own, not very advanced at all.

    It all basically uses the "execCommand" command thats available via transforming an iframe to a richtext editor.

    Have a look:
    http://lord-of-the-pings.blogspot.co...ly-simple.html
    Last edited by CSTruter; 06-30-2006 at 09:17 AM.

  • #3
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    922
    Thanks
    302
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by CSTruter
    Well... this is something you can easily google, but, if you want a VERY BASIC example of how to achieve this, i've got an example on my blog, this will just get you started to create your own, not very advanced at all.

    It all basically uses the "execCommand" command thats available via transforming an iframe to a richtext editor.

    Have a look:
    http://lord-of-the-pings.blogspot.co...ly-simple.html


    I wish I could copy those codes

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #5
    New Coder
    Join Date
    Jun 2006
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Code

    Code:
    <html>
    <head>
    <title>Extremely Simple Wysiwyg Example</title>
    <script language="JavaScript">
    
    var ColFocus="forecolor";
    
    function Start()
    {
    	Editor = document.getElementById('textbox').contentWindow.document;
    	Editor.designMode = "on";
    }
    
    function Format(action)
    {
    	Editor.execCommand(action,false,null);
    }
    
    
    function Colour(colour)
    {
    	Editor.execCommand(ColFocus,true,colour);
    }
    
    function ColourFocus(obj,select)
    {
    	document.all.FC.disabled = false;
    	document.all.BC.disabled = false;
    	Colfocus = select;
    	obj.disabled = true;
    }
    
    </script>
    
    </head>
    
    <body onload="Start()">
    
    	<input type="button" style="background-color:Green;width:20px" onclick="Colour('Green')"/>
    	<input type="button" style="background-color:Red;width:20px" onclick="Colour('Red')"/>
    	<input type="button" style="background-color:Blue;width:20px" onclick="Colour('Blue')"/>
    	<input type="button" style="background-color:Black;width:20px" onclick="Colour('Black')"/>
    	<input type="button" onclick="Format('bold')" value="B"/>
    	<input type="button" onclick="Format('italic')" value="I"/>
    	<input type="button" onclick="Format('underline')" value="U"/>
    	<input type="button" onclick="Format('justifycenter')" value="C"/>
    	<input type="button" onclick="Format('justifyleft')" value="L"/>
    	<input type="button" onclick="Format('justifyright')" value="R"/>
    	<input type="button" onclick="ColourFocus(this,'forecolor')" name="FC" value="FC"/>
    	<input type="button" onclick="ColourFocus(this,'backcolor')" name="BC" value="BC"/>
    	<br>
    
    	<iframe id="textbox" style="width: 300px;height:150px"></iframe>
    </body>
    </html>
    Last edited by CSTruter; 06-30-2006 at 03:42 PM.

  • #6
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    922
    Thanks
    302
    Thanked 3 Times in 3 Posts
    Yes and thanx mate

    You want me to send u an email as a reminder in case u forgot?

  • #7
    New Coder
    Join Date
    Jun 2006
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hey, I edited my post above hehehe, there's the code, quickly typed it out again, hehehehe

  • #8
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    922
    Thanks
    302
    Thanked 3 Times in 3 Posts
    Thanx so much mate


  •  

    Posting Permissions

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