Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Interesting Drop Down Box

Status
Not open for further replies.

ma701sd

IS-IT--Management
Dec 15, 2000
94
GB
I have a select drop down list. I can display the font name within the list but I want to show what the font looks like within the list...Is this possible?

AN example of what I'm trying to do is as follows:

<SELECT NAME =&quot;Fonts&quot;>
<OPTION VALUE=&quot;&quot;>Select type of Font
<OPTION VALUE=&quot;Arial&quot;> <FONT FACE=&quot;Arial&quot;> Arial </Font>

Can anyone help

Regards

Sam
 
i think you can style the options..

<option style=&quot;font-family:arial;&quot;>arial

actually i just tested, and apparently you can only use color and background-color styles in options. adam@aauser.com
 
what you can do tho, is to have a text box (or some text in between span) close to the select box, and when a font is selected, then the text box value is displayed with that font
should look like :
<select name=&quot;fonts&quot; onchange=&quot;javascript:[the path to your element in which the text to display is].style.font-family=this.options[this.selectedIndex].value&quot;>

 
Changing attributes of a select list does NOT work. There are, however, some dropdown list replacements that allow you to specify fonts, attributes and even images in the list options. Check out javascript.com.
Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
I don't know about using different fonts for each item in a drop down list, but you can use whatever font you want.

Use a CSS to define the style you want for the listbox and stick the 'class' attribute directly into the select element:

<select class=&quot;listbox&quot;>
<option>Please select...</option>
<option>Option 1</option>
<option>Option 2</option>
</select>

But if you want to display a different font for each option, I'd do as iza says above
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top