Thanks wow I didn't expect to get such a good answer so quickly !! - could u send the other bits to ajpb@linuxconsultant.co.uk
Thanks.
AJPB
Main Topics
Browse All TopicsHi Folks,
Does anyone know of a free, or 'non restrictively licensed' replacement for a TEXTAREA on a form, which would allow rich HTML editing (i.e. looking a bit like WordPad). We have several PHP/MySQL based content management systems in operation and are keen to allow 'rich' editing to clients who do not want to edit HTML code directly.
The reason this is in the javascript topic area is that we've seen similar ideas before, and they mostly appear to have been written in Javascript or Jscript.
Any resource pointers or even code snippets would be greatly appreciated. Something that kind of seems to do the job can be seen at :
http://standardbrains.edit
Although it seems to have bugs.. And it doesn't directly do everything we want. We need something that can save down to a PHP script (presumably by a form submission).. Our ideal solution would have clickable buttons for BOLD, UNDERLINE etc and possibly even some handling for bullets and numbering etc.
PS. I have now looked back through EE's archives and found several similar questions to this .. Does anyone have anything new? 'Cos all those are either restricted (license wise) or clunky or nasty.. New fresh ideas required :)) Thanks
AJ.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Medalan: Sure I can do that. Just tell me your email address.
No, the javascript it self does not write the data into a Mysql database. However, it takes the content from the editor and puts it into a textarea before submitting the form. Writing it to the database should be as easy as reading from the form post variables and writing the data into the database. Very simple.
Very nice, seen this done before but this is a far more elegant example.
Never come across iframes before so need a way of populating the frames html source with a form variable onload and also getting that info out as a form variable on submission. I seem to be having an existence prob when using the body onLoad() event to do this.
But i am a bit stupid so thats not surprising, any help would be lovely
trev@ladybee.co.uk
Thanks mate
Trev
Hi,
Since a lot of people have been emailing me and asking if I could send them the images and the extra information I sent to the original asker of this question, I decided to upload this to my server ....
So, please check this out before asking me ;) I'm really busy and can't really reply to everybody's emails ....
http://www.mmedia.is/~hagu
http://www.mmedia.is/~hagu
Regards,
Hagur
That's easy. Just read the data from the database and put it into a hidden textarea, or a javascript string variable.
Then create a javascript function that executes on the onLoad event of the body tag.
The purpose of this function is to take the contents from the hidden textarea (or the javascript text variable) and put it inside the editor.
Example of the function that should be executed at the onLoad event:
function fncLoadContents() {
document.frames('editor').
}
In this example, the editor is in an iframe on the page. The name of the iframe is "editor" and the hidden textarea is called "hiddenTextarea".
This should give you an idea how it's done ....
Business Accounts
Answer for Membership
by: hagurPosted on 2002-09-18 at 12:03:57ID: 7289322
This is really easy to do ..... just add the attribute CONTENTEDITABLE to a DIV tag or an IFRAME to make it's content editable.
ce; padding:0px; color:menutext;border-widt h:1px; border-style:solid;border- color:thre edhighligh t threedshadow threedshadow threedhighlight;} -LEFT: threedface 1px solid;BORDER-RIGHT: threedface 1px solid;BORDER-TOP: threedface 1px solid;BORDER-BOTTOM: threedface 1px solid;}
ript>
e',this[th is.selecte dIndex].va lue);" style="font-familiy:tahoma ;font-size :9px;"> > n> ion> ion> ption> s</option> e',this[th is.selecte dIndex].va lue);" style="font-familiy:tahoma ;font-size :9px;> ked)"><spa n style="font-family:tahoma; font-size: 10px;">Edi t HTML</span> border-wid th:1px;bor der-color: threedshad ow" frameborder="0"></iframe> his);" onmouseout="button_out(thi s);" onmousedown="button_down(t his);" onmouseup="button_up(this) ;"> his);" onmouseout="button_out(thi s);" onmousedown="button_down(t his);" onmouseup="button_up(this) ;"> onmouseover="button_over(t his);" onmouseout="button_out(thi s);" onmousedown="button_down(t his);" onmouseup="button_up(this) ;"> his);" onmouseout="button_out(thi s);" onmousedown="button_down(t his);" onmouseup="button_up(this) ;"> " onmouseover="button_over(t his);" onmouseout="button_out(thi s);" onmousedown="button_down(t his);" onmouseup="button_up(this) ;"> e')" onmouseover="button_over(t his);" onmouseout="button_out(thi s);" onmousedown="button_down(t his);" onmouseup="button_up(this) ;"> eft')" onmouseover="button_over(t his);" onmouseout="button_out(thi s);" onmousedown="button_down(t his);" onmouseup="button_up(this) ;"> enter')" onmouseover="button_over(t his);" onmouseout="button_out(thi s);" onmousedown="button_down(t his);" onmouseup="button_up(this) ;"> ight')" onmouseover="button_over(t his);" onmouseout="button_out(thi s);" onmousedown="button_down(t his);" onmouseup="button_up(this) ;"> deredlist' )" onmouseover="button_over(t his);" onmouseout="button_out(thi s);" onmousedown="button_down(t his);" onmouseup="button_up(this) ;"> orderedlis t')" onmouseover="button_over(t his);" onmouseout="button_out(thi s);" onmousedown="button_down(t his);" onmouseup="button_up(this) ;"> )" onmouseover="button_over(t his);" onmouseout="button_out(thi s);" onmousedown="button_down(t his);" onmouseup="button_up(this) ;"> " onmouseover="button_over(t his);" onmouseout="button_out(thi s);" onmousedown="button_down(t his);" onmouseup="button_up(this) ;"> his);" onmouseout="button_out(thi s);" onmousedown="button_down(t his);" onmouseup="button_up(this) ;"> nk')" onmouseover="button_over(t his);" onmouseout="button_out(thi s);" onmousedown="button_down(t his);" onmouseup="button_up(this) ;">
lor = "#B5BDD6";
lor = "threedface";
lor = "#8494B5";
lor = "#B5BDD6";
e()
ode="On"
uncheck 'Edit HTML'");return;}
mand(cmd," ",opt);idC ontent.foc us();
t.document .body.inne rHTML;idCo ntent.docu ment.body. innerText= sTmp;}
ody.innerT ext;idCont ent.docume nt.body.in nerHTML=sT mp;}
uncheck 'Edit HTML'");return;}
htm","","f ont-family :Verdana; font-size:12; dialogWidth:30em; dialogHeight:34em" );
Anyways, here is something I've used many times:
editor.html:
--------------
<html>
<head>
<title>Editor</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000" topmargin="0" leftmargin="0" bottommargin="0" rightmargin="0">
<STYLE TYPE="text/css">
TABLE#tblCoolbar {background-color:threedfa
.cbtn {height:15;width:15;BORDER
.txtbtn {font-family:tahoma; font-size:70%; color:menutext;}
</STYLE>
<script language="javascript" src="modal_dialog.js"></sc
<table width="100%" cellpadding="0" cellspacing="0" border="0" height="100%">
<tr>
<td colspan="2" valign="top" height="20">
<table id="tblCoolbar" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="100">
<select onchange="cmdExec('fontnam
<option selected>Leturgerp</option
<option value="Arial">Arial</optio
<option value="Arial Black">Arial Black</option>
<option value="Arial Narrow">Arial Narrow</option>
<option value="Comic Sans MS">Comic Sans MS</option>
<option value="Courier New">Courier New</option>
<option value="System">System</opt
<option value="Tahoma">Tahoma</opt
<option value="Times New Roman">Times New Roman</option>
<option value="Verdana">Verdana</o
<option value="Wingdings">Wingding
</select>
</td>
<td width="20">
<select onchange="cmdExec('fontsiz
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="10">10</option>
<option value="12">12</option>
<option value="14">14</option>
</select>
</td>
<td>
<input type="checkbox" onclick="setMode(this.chec
</td>
</tr>
</table>
</td>
</tr>
<tr valign="middle">
<td valign="top">
<iframe width="100%" id="idContent" height="100%" style="border-style:solid;
</td>
<td valign="top" width="40">
<table id="tblCoolbar" cellpadding="0" cellspacing="0" border="0" height="100%">
<tr>
<td valign="top">
<table id="tblCoolbar" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<div class="cbtn" onClick="cmdExec('cut')" onmouseover="button_over(t
<img hspace="1" vspace=1 align=absmiddle src="images/Cut.gif" alt="Cut">
</div>
</td>
<td>
<div class="cbtn" onClick="cmdExec('copy')" onmouseover="button_over(t
<img hspace="1" vspace=1 align=absmiddle src="images/Copy.gif" alt="Copy">
</div>
</td>
<td>
<div class="cbtn" onClick="cmdExec('paste')"
<img hspace="1" vspace=1 align=absmiddle src="images/Paste.gif" alt="Paste">
</div>
</td>
</tr>
<tr>
<td>
<div class="cbtn" onClick="cmdExec('bold')" onmouseover="button_over(t
<img hspace="1" vspace=1 align=absmiddle src="images/Bold.gif" alt="Bold">
</div>
</td>
<td>
<div class="cbtn" onClick="cmdExec('italic')
<img hspace="1" vspace=1 align=absmiddle src="images/Italic.gif" alt="Italic">
</div>
</td>
<td>
<div class="cbtn" onClick="cmdExec('underlin
<img hspace="1" vspace=1 align=absmiddle src="images/Under.gif" alt="Underline">
</div>
</td>
</tr>
<tr>
<td>
<div class="cbtn" onClick="cmdExec('justifyl
<img hspace="1" vspace=1 align=absmiddle src="images/Left.gif" alt="Justify Left">
</div>
</td>
<td>
<div class="cbtn" onClick="cmdExec('justifyc
<img hspace="1" vspace=1 align=absmiddle src="images/Center.gif" alt="Center">
</div>
</td>
<td>
<div class="cbtn" onClick="cmdExec('justifyr
<img hspace="1" vspace=1 align=absmiddle src="images/Right.gif" alt="Justify Right">
</div>
</td>
</tr>
<tr>
<td>
<div class="cbtn" onClick="cmdExec('insertor
<img hspace="2" vspace=1 align=absmiddle src="images/numlist.gif" alt="Ordered List">
</div>
</td>
<td>
<div class="cbtn" onClick="cmdExec('insertun
<img hspace="2" vspace=1 align=absmiddle src="images/bullist.gif" alt="Unordered List">
</div>
</td>
<td>
<div class="cbtn" onClick="cmdExec('outdent'
<img hspace="2" vspace=1 align=absmiddle src="images/deindent.gif" alt="Decrease Indent">
</div>
</td>
</tr>
<tr>
<td>
<div class="cbtn" onClick="cmdExec('indent')
<img hspace="2" vspace=1 align=absmiddle src="images/inindent.gif" alt="Increase Indent">
</div>
</td>
<!--<td>
<div class="cbtn" onClick="foreColor()" onmouseover="button_over(t
<img hspace="2" vspace=1 align=absmiddle src="images/fgcolor.gif" alt="Forecolor">
</div>
</td>-->
<td>
<div class="cbtn" onClick="cmdExec('createLi
<img hspace="2" vspace=1 align=absmiddle src="images/Link.gif" alt="Link">
</div>
</td>
</tr>
<tr>
<td height="50"></td>
</tr>
</table>
</td>
<tr>
</table>
</td>
</tr>
</table>
</body>
</html>
---------------------
end of editor.html
Another file, modal_dialog.js must be placed in the same folder as editor.html
modal_dialog.js:
---------------------
function button_over(eButton)
{
eButton.style.backgroundCo
eButton.style.borderColor = "darkblue darkblue darkblue darkblue";
}
function button_out(eButton)
{
eButton.style.backgroundCo
eButton.style.borderColor = "threedface";
}
function button_down(eButton)
{
eButton.style.backgroundCo
eButton.style.borderColor = "darkblue darkblue darkblue darkblue";
}
function button_up(eButton)
{
eButton.style.backgroundCo
eButton.style.borderColor = "darkblue darkblue darkblue darkblue";
eButton = null;
}
var isHTMLMode=false
function document.onreadystatechang
{
idContent.document.designM
}
function cmdExec(cmd,opt)
{
if (isHTMLMode){alert("Please
idContent.document.execCom
}
function setMode(bMode)
{
var sTmp;
isHTMLMode = bMode;
if (isHTMLMode){sTmp=idConten
else {sTmp=idContent.document.b
idContent.focus();
}
function createLink()
{
if (isHTMLMode){alert("Please
cmdExec("CreateLink");
}
function foreColor()
{
var arr = showModalDialog("selcolor.
if (arr != null) cmdExec("ForeColor",arr);
}
----------------------
End of modal_dialog.js
There are also a lot of images which have to be put in a folder called Images. If you leave your e-mail address, I can send them to you.
Of course this only works with IE, and it works rather well. You can edit the HTML-source aswell as using a WYSISWG mode.
All it takes to post this into database is a little javascript. I can also send that to you if you'd like.
Let me know what you want to do.