I'm not sure how well this will work in Netscape... but it definately works in IE 5.0 and above...
<SCRIPT type="text/javascript"> function doBoldText(){ var mySelection = document.selection.createRange(); var tmpText = mySelection.text; tmpText = "<b>" + tmpText + "</b>"; mySelection.text = tmpText; } </SCRIPT> <form name="foo"> <textarea name="mytext" cols="50" rows="6"></textarea> <input type="button" name="goBold" value="Make Bold" onclick="doBoldText()"> </form> HTH, Jeff Garza ----- Original Message ----- From: "Barney Boisvert" <[EMAIL PROTECTED]> To: "CF-Talk" <[EMAIL PROTECTED]> Sent: Thursday, August 21, 2003 3:13 PM Subject: RE: form/javascript help that will wrap the entire form field value. I don't think that it's possible to wrap only a portion with javascript. --- Barney Boisvert, Senior Development Engineer AudienceCentral [EMAIL PROTECTED] voice : 360.756.8080 x12 fax : 360.647.5351 www.audiencecentral.com > -----Original Message----- > From: Joshua Miller [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 21, 2003 2:21 PM > To: CF-Talk > Subject: RE: form/javascript help > > > <script> > function wrapWithTag(formObj,tagname){ > formObj.value="<"+tagname+">"+formObj.value+"</"+tagname+">"; > } > </script> > > <form name="myform"> > <input type="text" name="mytext" value="Whatever"> > </form> > > <input type="button" name="button" value="Button" > onclick="wrapWithTag(myform.mytext,'b');"> > > > Joshua Miller > Head Programmer / IT Manager > Garrison Enterprises Inc. > www.garrisonenterprises.net > [EMAIL PROTECTED] > (704) 569-0801 ext. 254 > > ************************************************************************ > ************* > Any views expressed in this message are those of the individual sender, > except where the sender states them to be the views of > Garrison Enterprises Inc. > > This e-mail is intended only for the individual or entity to which it is > addressed and contains information that is private and confidential. If > you are not the intended recipient you are hereby notified that any > dissemination, distribution or copying is strictly prohibited. If you > have received this e-mail in error please delete it immediately and > advise us by return e-mail to [EMAIL PROTECTED] > ************************************************************************ > ************* > > > -----Original Message----- > From: Phillip B [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 21, 2003 1:26 PM > To: CF-Talk > Subject: OT: form/javascript help > > > I know this can be done but I stink at java script. I want to select > some text in a text field. Then click a graphic on the page and have it > put an HTML tag around the selected text in the form field. Any idea on > how to do this or where to find the code that does this? > > Phillip B. > > www.LoungeRoyale.com > www.FillWorks.com > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com