A directory of browser-based WYSIWYG editors


Home: htmlArea 2: htmlArea 2 & 3 archive (read only): htmlArea v2.0:
insert a determined number of characters

The htmlArea 2 & 3 editors have been discontinued.

We've made these forums available as a read-only reference and knowledge-base for people using or developing editors based on htmlArea 2 or 3.

Anyone who is interested in taking over version 2 or 3 is free to do so. All we ask is that you choose a new name that doesn't have "htmlarea" in it to avoid confusion with this site. We'll even give you a link in the directory to make it easier for people to find you. If you are developing or hosting an htmlArea based-editor under a new name, please submit it to our directory.


New User

Jan 20, 2005, 6:31 AM

Post #1 of 2 (1919 views)
insert a determined number of characters Can't Post

hello.I would like to insert a determined number of characters. is it possible?

(This post was edited by massimo80 on Jan 20, 2005, 7:11 AM)


Jan 25, 2005, 11:04 AM

Post #2 of 2 (1885 views)
Re: [massimo80] insert a determined number of characters [In reply to] Can't Post

All things are possible. The question is how much work does it take.

The following javascript function takes a character (or string) and a number as inputs and returns a string of that many characters (WARNING: This script is not safe. Users can do something stupid like putting in a character for the number and it will choke.

function repeat(char,num) {
var hold='';
for (i=0;i<num;i++){ hold += char; }
return hold;

The following form makes use of the above script to insert such a repeated character into an htmlArea field:

<form name=repeatstring>
<label for=mychar>Character</label> <input type=text maxlength=1 size=1 name=mychar value="">
<label for=mynum>Repeat</label> <input type=text maxlength=3 size=1 name=mynum value="">
<input type=submit onclick="editor_insertHTML('mytextareaname',repeat(this.form.mychar.value,this.form.mynum.value)); return false;" value="Repeat">


Search for (options)