Inquire again

D

Dung Ping

I posted a similar question quite a while ago, but didn't get positive
answer. Beofore turning to other approaches, I would like to check
again. Following is what I like to do:

Chinese is a tone language. There are four tones that are referred to
as Tone 1 through Tone 4. The language is usually written with an
ideographic script of characters. But there is a less-used alphabetic
writing that consists of the 26 letters for English and 4 diacritics
for the 4 tones.

I like to develop a very simple word processor contained preferably in
a textarea of form. When the numbers 1 to 4 are typed after a letter
spelling, they will become a superscript. This is a must because that
when reading the script, the tone marks are not part of the spelling
process as the letters are. They only indicate a feature of the sound.
Therefore, by nature they are diacritics. If appearing after letter
spellings as regular-sized numbers, they would obstruct the smooth
spelling process. Native speakers of Chinese don't like that.

I know MS Keyboard Layout Creator may accomplish this. But I like to
know whether this can also be done with Javascript, because I intend to
put the program on the Internet for other people to test and discuss
it.

Another thing is that if the numbers 1 to 4 do not immediately follow
an alphabetic letter, they will appear as regular-sized numbers. I
don't think I have the ability to do the programing on the MSKLC.

I am a very slow learner for Javascript, in fact for any programing
language. But I am still interested to learn Javascript for its
usefulness on the Internet. So first of all, I like to know whether or
not this can be accomplished with Javasript, no matter how difficult or
complicated the programing would be.

Thanks in advance.
Dung Ping
 
R

Randy Webb

Dung Ping said the following on 9/18/2005 1:44 PM:
I posted a similar question quite a while ago, but didn't get positive
answer. Beofore turning to other approaches, I would like to check
again. Following is what I like to do:

Chinese is a tone language. There are four tones that are referred to
as Tone 1 through Tone 4. The language is usually written with an
ideographic script of characters. But there is a less-used alphabetic
writing that consists of the 26 letters for English and 4 diacritics
for the 4 tones.

I like to develop a very simple word processor contained preferably in
a textarea of form. When the numbers 1 to 4 are typed after a letter
spelling, they will become a superscript. This is a must because that
when reading the script, the tone marks are not part of the spelling
process as the letters are. They only indicate a feature of the sound.
Therefore, by nature they are diacritics. If appearing after letter
spellings as regular-sized numbers, they would obstruct the smooth
spelling process. Native speakers of Chinese don't like that.

You wouldn't be able to do it in a textarea of a form because you can
not superscript in a text area. Its text-only and making it a
superscript it requires HTML so you can't. What you can do is use a DIV
tag with contentEditable (IE only, MOZ has a comparative feature). Its a
DIV tag that you can edit the content. You would need an onkeydown event
handler on the DIV that checked to see if the key pressed was 1-4 and
replace it with said:
Another thing is that if the numbers 1 to 4 do not immediately follow
an alphabetic letter, they will appear as regular-sized numbers. I
don't think I have the ability to do the programing on the MSKLC.

Do you want to allow this:

"This is a 1 test"

Or disallow it?

If you want to allow it, then you add a check in your onkeydown function
to check to see what the previous character was. If it was a space, keep
going. If not, make it superscript.

If you dont want to allow it, then you also handle that in the function.
 
D

Dung Ping

Randy said:
Dung Ping said the following on 9/18/2005 1:44 PM:


You wouldn't be able to do it in a textarea of a form because you can
not superscript in a text area. Its text-only and making it a
superscript it requires HTML so you can't. What you can do is use a DIV
tag with contentEditable (IE only, MOZ has a comparative feature). Its a
DIV tag that you can edit the content. You would need an onkeydown event
handler on the DIV that checked to see if the key pressed was 1-4 and
replace it with <sup>#</sup>.

My understanding is this contenEditable would allow people to type in
an area in the HTML page, just like typing in the textarea of a form.
I will try this step first, then the next. Thanks a lot.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
474,263
Messages
2,571,064
Members
48,769
Latest member
Clifft

Latest Threads

Top