You are here: Re: How Do I Put the Greek Letter Pi on a Button? « HTML « IT news, forums, messages
Re: How Do I Put the Greek Letter Pi on a Button?

Posted by Jukka K. Korpela on 02/06/07 07:45

Scripsit kvnsmnsn@hotmail.com:

> My next question is, is there a way in XHTML to print an arrow that
> points both ways? Is there a "⇄", maybe?

Things don't work quite that way, by making up entities. In HTML, you can
use any Unicode character. A small minority of them has entity names defined
for them, but that's rather irrelevant. So basically you could take a look
at the Unicode block Arrows and then consider how widely the characters in
it are available in _fonts_ in common use; this is relevant, entities are
not. Incidentally, there are entities ↔ for left right arrow and ⇔
for left right double arrow, and ↔ alias ↔ is probably what you
want, since it's basically the two-way counterpart of ←

(XHTML adds nothing but confusion to HTML, as far as practical use as
delivery format of web pages at present is considered.)

> Also, how do you put subscripts and superscripts on buttons?

There are Unicode characters for some subscripts and superscripts, but most
of them (beyond superscript 1, 2, and 3) are poorly supported in fonts, and
the repertoire is rather limited - there is no superscript y for example.

The other approach is to use <sub> or <sup> markup, but for that, you need a
context where markup (tags) are allowed, and a value="..." attribute (or any
attribute for that matter) is not such a context. There's the possibility of
using the <button> element, where you specify the button text as the content
of the element, where markup is allowed.

> I've currently got an "x ^ y" that I would rather represent as "x" with
> "y"
> as a superscript, and a "log_x y that I would rather represent as
> "log" with "x" as a subscript.

You could use

<button type="submit" name="foo" value="bar">
<var>x</var><sup><var>y</var></sup>
</button>
<hr>
<button type="submit" name="foo2" value="bar2">
log<sub><var>x</var></sub><var>y</var>
</button>

Beware that the rendering of button texts, especially with superscripts or
subscripts, can be rather awkward, so consider using a suitable style sheet
like

button { font-family: Verdana; font-size: 100%; }

The main problem with <button> is that Internet Explorer (including version
7) gets it fundamentally wrong. It does not send data like foo=bar or
foo2=bar2 as it should; instead it sends the name of the button followed by
an equals sign and the _content_ of the element, resulting in a mess
foo=%3CVAR%3Ex%3C%2FVAR%3E%3CSUP%3E%3CVAR%3Ey%3C%2FVAR%3E%3C%2FSUP%3E
This may not matter if you can arrange things so that all the buttons have
unique names, so that you can look at the name part of the data only, or if
you use buttons other than submit buttons (e.g. <button type="button" ...>
for scripted buttons that are supposed to work using client-side JavaScript.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 

Navigation:

[Reply to this 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

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