...

View Full Version : Rich Text Box Code



phantom007
06-29-2006, 02:23 PM
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


http://photobag.2plans.com/images/81889120.jpg (http://photobag.2plans.com/)

CSTruter
06-30-2006, 09:14 AM
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.com/2006/02/adding-some-colour-to-extremely-simple.html

phantom007
06-30-2006, 09:18 AM
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.com/2006/02/adding-some-colour-to-extremely-simple.html



I wish I could copy those codes

_Aerospace_Eng_
06-30-2006, 10:01 AM
http://www.dynamicdrive.com/dynamicindex16/openwysiwyg/index.htm
http://www.dynamicdrive.com/dynamicindex16/richtexteditor/index.htm

CSTruter
06-30-2006, 11:03 AM
<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>

phantom007
06-30-2006, 11:05 AM
Yes and thanx mate :)

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

CSTruter
06-30-2006, 11:20 AM
Hey, I edited my post above hehehe, there's the code, quickly typed it out again, hehehehe

phantom007
06-30-2006, 01:13 PM
Thanx so much mate



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum