Connecting Tech Pros Worldwide Help | Site Map

How to wrap the word of a select component?

  #1  
Old July 20th, 2005, 03:30 PM
Michael Qiu
Guest
 
Posts: n/a

I hava a select component on my form. the width of the select component is fixed,so if the length of the option's shown string larger than the select component's width,how can i make the shown string wrap to next line?

<select name=123 style="width:100px;height:200px">
<option value=1>abcdefghijklmnopqrstuvwxyz</option>
</select>

select component's width is 100px, the option's shown sring is abcdefghijklmnopqrstuvwxyz,if shown string's length is larger tthan 100px ,how can auto wrap it to next line?

I'm sorry,my english is very poor! many thanks!


Michael Qiu
qq_qiutao@sina.com

  #2  
Old July 20th, 2005, 03:30 PM
Michael Winter
Guest
 
Posts: n/a

re: How to wrap the word of a select component?


On Sat, 14 Feb 2004 00:07:43 +0800, Michael Qiu <qq_qiutao@sina.com> wrote:
[color=blue]
> I hava a select component on my form. the width of the select
> component is fixed,so if the length of the option's shown string larger
> than the select component's width,how can i make the shown string wrap
> to next line?[/color]

You can't, as far as I know. You'll either have to expand the control or
abbreviate the text.

Mike

--
Michael Winter
M.Winter@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
  #3  
Old July 20th, 2005, 03:30 PM
Randy Webb
Guest
 
Posts: n/a

re: How to wrap the word of a select component?


Michael Qiu wrote:
[color=blue]
> I hava a select component on my form. the width of the select
>component is fixed,so if the length of the option's shown string
>larger than the select component's width,how can i make the shown
>string wrap to next line?
>
> <select name=123 style="width:100px;height:200px">
> <option value=1>abcdefghijklmnopqrstuvwxyz</option>
> </select>
>
> select component's width is 100px, the option's shown sring is
> abcdefghijklmnopqrstuvwxyz,if shown string's length is larger
> tthan 100px ,how can auto wrap it to next line?
>[/color]

And if you word wrap it, how will it display that selection?
px is a bad size definition also. If I have my font-size set to largest
and my neighbor has it set to smallest, then you get different results.
And, iiiiiiiiiiiiiiiii will not display as wide as XXXXXXXXXXXXXXXX nor
will xxxxxxxxxxxxxxxxx display as wide as XXXXXXXXXXXXXXXXXXX

XXXXXXXXXXXXXXXXXXX
iiiiiiiiiiiiiiiii
xxxxxxxxxxxxxxxxx

unless you specify a fixed width font.

One possible solution, that has many major flaws.

Display it as a multiple select list, specify the width in em's, specify
a fixed width font, with a fixed pitch, and then loop through the
elements and when you find one whose .text is wider, truncate it, create
a new option right below it, and append the text, keeping the same
value. And then hope/pray that your users don't have js disabled, dont
have CSS disabled, and that the browser supports what you are trying to
do, and then they dont get pissed at you for @#$%@#'ing with there display.

In short? Redesign your page to handle your options.

And for crying out loud, please get a newsreader that will wrap your lines.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/

  #4  
Old July 20th, 2005, 03:31 PM
Michael Qiu
Guest
 
Posts: n/a

re: How to wrap the word of a select component?




thanks a lot!It's appreciated that you give me an immediate reply. I
will have a try according to your suggestion! thank you !

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Resize only the height of Form Rob answers 6 November 21st, 2005 06:59 PM
Word Wrap while Printing Jeff B. answers 10 November 17th, 2005 04:00 AM
Need a bit of C# help MFC answers 5 November 16th, 2005 11:30 AM
Is anything easier to do in java than in lisp? RobertMaas@YahooGroups.Com answers 73 July 18th, 2005 12:25 AM