Reply to Re: How to change a number to superscript in textarea?

Your name:

Reply:


Posted by Benjamin Niemann on 08/27/05 18:50

dalei wrote:

> When typing several numbers in the textarea of form, I need them change
> to superscripts. Could anyone teach me how to ahieve the effects.

You can't do this (really) with a textarea. The only exception are
superscript 1, 2 and 3 for which there are characters available in
iso-8859-1 (can be entered with alt-1, -2 and -3 on my keyboard layout).
Don't know, if unicode defines more superscript numbers and if these are
present in commonly used fonts.

Another solution would be to allowed (a subset of) HTML in the text entered,
so a user can enter things like "foo<sup>4711</sup>" - this will only make
sense, if the text is supposed to be displayed as HTML again. And you will
have to worry about various security issues (malicious JS code insertion by
an attacker), so you have to parse the submitted text an filter all HTML
tags that are not whitelisted.

The latter option could be made more comfortable for users with
IE/NS/Firefox and JS enabled by using a so called WYSIWYG component which
replaces the textarea by a "MS Word" style editing area. Such components
are available as open source (http://freshmeat.net/search/?q=wysiwyg+html).

--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация