Also follow this Post
http://www.experts-exchang
Main Topics
Browse All TopicsI have a textarea box on my website, and allow HTML encoding in it, but I found no one uses the HTML cause they dont know basic html,
I would like to put a few buttons on the top that will allow html editing, for example if in the text are the user types "hello my name is Bill" I would like them to highlight the word Bill and then click the bold button above and it would bold the text and then when submitted would include the html in the submission.
Bill D
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.
Also follow this Post
http://www.experts-exchang
FROM:
http://msdn.microsoft.com/
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Editable Regions Sample</TITLE>
<LINK REL="stylesheet" HREF="/workshop/samples/au
<STYLE>
body{
margin:0;
background:white;
font-family:verdana;
font-size:80%;
}
.bar{
background:#336699;
width:100%;
height:30px;
border-top:1px solid #99CCFF;
border-bottom:1px solid #000000;
}
.desbar{
background:#FFFFFF;
width:100%;
padding: 10px;
border-top:1px solid #CCCCCC;
border-bottom:1px solid #000000;
color:black;
font-size:8pt;
height:105;
}
.title{
font-size:15pt;
color:white;
padding-left:10px;
}
PRE { margin:0}
a:link
{
text-decoration:none;
color:white
}
a:visited
{
text-decoration:none;
color:white
}
a:active
{
text-decoration:none;
color:white
}
a:hover
{
text-decoration:none;
color:yellow
}
BUTTON {cursor:hand; background:#ffffff; border-color:#99ccff; font-weight:bold;}
</STYLE>
<SCRIPT>
function fnToggleEdits(oObj,oBtn) {
currentState = oObj.isContentEditable;
newState = !currentState;
oObj.contentEditable = newState;
newState==false ? oBtn.innerHTML='Editing On' :
oBtn.innerHTML='Editing Off';
}
</SCRIPT>
</HEAD>
<BODY >
<!-- TOOLBAR_START --><!-- TOOLBAR_EXEMPT --><!-- TOOLBAR_END -->
<DIV CLASS="bar title">
Editable Regions Sample
</DIV>
<DIV CLASS="desbar">
<H4 style="font-size:10pt;">
This example demonstrates the features of Microsoft® Internet Explorer that enable users to edit the content of an HTML element directly from the browser.
</H3>
<P> This HTML editor is a DIV element set to be content editable. Any valid HTML content (text, images, form controls, etc.) can be pasted and edited in this editor.</P>
<div align="center">
<DIV UNSELECTABLE ALIGN="center" STYLE="height:210; width:90%; background-color:#99CCFF; border:1px solid black">
<DIV CLASS="bar title">HTMLEditor (Content Editable DIV)</DIV>
<DIV style="padding:10px">
<BUTTON UNSELECTABLE ID="oEditDiv" TITLE="Editing Off" onclick='fnToggleEdits(oDi
<BUTTON UNSELECTABLE TITLE="Bold" onclick='if (oDiv.isContentEditable==t
<BUTTON UNSELECTABLE TITLE="Italic" onclick='if (oDiv.isContentEditable==t
<BUTTON UNSELECTABLE TITLE="Underline" onclick='if (oDiv.isContentEditable==t
</DIV>
<DIV id=oDiv contenteditable ALIGN=left STYLE="height:100; width:95%;background-color
border:inset #99ccff; scrollbar-base-color:#99cc
<BUTTON UNSELECTABLE TITLE="Append from HTMLEditor" onclick='oTextarea.value+=
Append to TextEditor</BUTTON>
</DIV>
</div>
<BR/>
<P>This text editor is a TEXTAREA element and is content editable by default. Only text can be edited in this tool. However, you can draft HTML in TEXTEditor and press the Append to HTMLEditor button to see the result appended to HTMLEditor. The Append to TextEditor button reverses this process by appending the HTMLEditor's HTML as text to TEXTEditor.<BR/><BR/>
<br>
<div align="center">
<DIV UNSELECTABLE ALIGN="center" STYLE="height:210; width:90%; background-color:#99ccff; border:1px solid black">
<DIV CLASS="bar title">TEXTEditor (TEXTAREA)</DIV>
<DIV style="padding:10">
<BUTTON UNSELECTABLE ID="oEditText" TITLE="Editing Off"
onclick='fnToggleEdits(oTe
</DIV>
<TEXTAREA id=oTextarea ALIGN=left STYLE="height:100; width:95%;background-color
<BR/>
<BUTTON UNSELECTABLE TITLE="Append to HTMLEditor" onclick='oDiv.innerHTML+=o
Append to HTMLEditor</BUTTON>
</DIV>
</div>
<BR/><P>Both editors use the same function to activate or deactivate editing. The function uses the <b>isContentEditable</b> property to test whether editing is active. Accordingly, the <b>contentEditable</b> property is then reversed to reset editing.
</DIV>
<DIV CLASS="bar" STYLE=" padding:5px; padding-left:10">
<A href="http://www.microsoft
©2002 Microsoft Corporation . All rights reserved. Terms of use</A>.
</DIV>
<P><HR><font color="black" face="ms sans serif" size="1">©<a href="http://msdn.microsof
</body>
</html>
Cd&
http://msdn.microsoft.com/
document.execCommand("bold
@COBOL
That is what I was looking for, the first example from adilkhan was kinda right but I didnt want to see the HTML code, jsut the result of HTML code
I am no good at JS, how would I go about making this one box (the tope one) and have it included with my already existent form, my textarea is called "J_CONTENT", could you put a sample little thing together with one or two options (Bold and Links) and Im sure I could figure it out after that.
Thanks Very Much, appreciate the fast responses from everyone :)
Bill D
kay here is a simplified version with several edit functions. Hyperlinks are automatically generated for any url that is typed in.
Note yu still have to have both boxes but the one that submits the HTML is now hidden. You have to do it theis way because the information has to move back and forth between an editable div and a text area t preserve the formatting when it gets to the server.
When the form gets submitted the content in the edit area is automatically sent to the text area as html and that is what get submitted. if yu are brining the content back, then the sting goes into the hidden textarea and yu display it in the dive by doing the body tag this way:
<body onLoad="oDiv.innerHTML=oTe
If they then re-edit it, the new versin will be moved to the text area when they submit.
Cd&
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Small Editor</title>
<style>
body{
margin:0;
background:white;
font-family:verdana;
font-size:80%;
}
a:link
{
color:blue
}
button {cursor:hand; background:#ffffff; border-color:#99ccff; font-weight:bold;}
</style>
</head>
<body>
<div align="center">
<div UNSELECTABLE align="center" style="height:210; width:90%;">
<div>HTMLEditor (Content Editable DIV)</div>
<div style="padding:10px">
<button UNSELECTABLE title="Bold" onclick='if (oDiv.isContentEditable==t
<button UNSELECTABLE title="Italic" onclick='if (oDiv.isContentEditable==t
<button UNSELECTABLE title="Underline" onclick='if (oDiv.isContentEditable==t
</div>
<div id=oDiv contenteditable align=left style="height:100; width:95%;background-color
</div>
</div>
<form method="get" action="somescript.asp">
<div UNSELECTABLE STYLE="display:none">
<textarea name="tarea" id=oTextarea align=left style="height:100; width:95%;background-color
</div>
<!--
THE REST OF YOUR FORM ELEMENTS GO HERE
-->
<input type="submit" onclick='oTextarea.value+=
</form>
</body>
</html>
if yu are looking for IE look at the following article:
http://msdn.microsoft.com/
Nushi.
Very high quality HTML editor with source code:
http://www.fredck.com/FCKe
(This HTML text editor brings to the web many of the powerful functionalities of known desktop editors like Word. It's really lightweight and doesn't require any kind of installation in the client computer.
As it is Open Source, you are allowed to use it for free wherever you want.)
Text Area Editor for HTML written in javascript, with source code:
http://www.codeproject.com
Hi-
I know this has nothing to do with any of this, but I don't have enough points to ask a question. I would like to know if there is a way to find the position of the cursor in a textarea. Like, say the user clicks somewhere in a textarea. I would like to find where they clicked, or what character the cursur is at. Is this possible?
-IceMetalPunk2008
Cant see this in any comments (if there is a link to it sorry) so
http://www.interactivetool
Excellent tool
Business Accounts
Answer for Membership
by: adilkhanPosted on 2003-09-05 at 13:16:39ID: 9298547
here View the Code for this Example.
ge.com/Tex tEditorDem o
http://marxidad.editthispa