Entry
How can I indent OPTIONs, fill them with blanks?
Mar 5th, 2000 23:27
Martin Honnen,
Actually this page faqts use to enter knowledge base entries
demonstrates how you can use the following character entity
to insert non breaking spaces into the OPTION text to format the OPTION
appearance. So
<SELECT NAME="aSelect">
<OPTION>Kibology
<OPTION> &nsbp;Introduction
<OPTION> Kibology for believers
<OPTION> Kibology for atheists
</SELECT>
gives you some indented OPTIONs.
If you use JavaScript do dynamically add an OPTION you have to use the
character or character code equivalent to
The character code is
160
so
String.fromCharCode(160)
or
'\u00A0'
is the character to use in a string. Example:
<FORM NAME="formName">
<A HREF="javascript: var select = document.formName.aSelect;
var option =
new Option (String.fromCharCode(160, 160, 160, 160) +
'Kibology for mensa members');
select.options[select.options.length] = option;
void 0
">
add an indented option
</A>
<SELECT NAME="aSelect">
<OPTION>Kibology
<OPTION> Introduction
<OPTION> Kibology for believers
<OPTION> Kibology for atheists
</SELECT>
</FORM>