why this code shows <b> tags?
<html >

  <title>My Editor</title>
    <script type="text/javascript">
      var displayText="";
       function boldText(){
          oForm = document.forms[0];
          oTextarea = oForm.elements["txtArea"];
          textarea_val = oTextarea.value;
          oTextarea.value = textarea_val.bold();

Recommended Answers

All 4 Replies

Because that's what .bold() does - wraps a string in <b>...</b> tags.

Creating a WYSIWYG device is not trivial. Personally I would install something ready-written. TinyMCE is quite popular but it's certainly not the only one.


to Airshow: how can i use it please? is it complicated?

I only used TinyMCE very briefly once on a site that had been created by someone else so I have never installed it from scratch.

It comes as a stand-alone app, or a jquery plugin. Suggest you use the stand-alone version unless you already use jQuery in your site.

Installation follows a standard pattern for javascript libs/plugins -

  1. Download TinyMCE or TinyMCE jQuery Package and save to your source tree.
  2. If you choose the jquery version, then insert a <script src="...jquery.js"></script> statement in the head of your page(s) (if not already there)
  3. Insert a <script src="...tinymce.js"></script> statement in the head of your page(s)
  4. Go here and "View source" for sample HTML and tinyMCE.init script. Note: that is a fully featured example - I expect a typical .init will be less extensive.

There's always a bit of fiddle-faddling to get these things working - normally to get the path to the .js files right (I tend to keep my js orgaised in subdirectory(s)).


thank you..!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.