0

why this code shows <b> tags?

<html >

<head>
  <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();
    }
    </script>
</head>

Edited by Dani: Formatting fixed

2
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by divsok
0

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.

Airshow

0

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

Edited by divsok: n/a

0

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)).

Airshow

Edited by Airshow: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.