473,327 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

How to wrap the word of a select component?


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*******@sina.com

Jul 20 '05 #1
3 2386
On Sat, 14 Feb 2004 00:07:43 +0800, Michael Qiu <qq*******@sina.com> wrote:
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?


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

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #2
Michael Qiu wrote:
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?


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/

Jul 20 '05 #3


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!
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Adam Knight | last post by:
I am trying to create a word document via asp. I keep getting this error: Server object, ASP 0178 (0x80070005) The call to Server.CreateObject failed while checking permissions. Access is...
6
by: Jason Steeves | last post by:
I am hoping someone can tell me how, or point me in the right direction for the following problem. I need to have word open a specified file, .mht, as a plug-in inside of IE so that I can edit...
8
by: name | last post by:
Back again for more critique... <grin> ------------------------------------------------ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <limits.h> #define MAX 10000
10
by: Jeff B. | last post by:
Has anyone come across a decent algorithm for implementing word wrap features in .net printing? I have a small component that uses basic printing techniques (i.e. e.Graphics.DrawString in a...
0
by: Rocco | last post by:
Hi, I have learnt that there is a CSS extension of microsoft called { word-wrap : sWrap } which can be applied to <SELECT> (i.e. drop down box). How to use this in drop down box ? Besides,...
10
by: Lorenzo Thurman | last post by:
I have a table cell that I want to wrap text inside of. I've tried both hard and soft wrap, but Firefox refuses to obey. IE 6&7 handle the wrap just fine. Does anyone know how I can fix this?
1
by: laura.paterson | last post by:
Hi, I'm new to html, and having difficulty getting my text to wrap around an image the way I'd like it to.. I have an image in the top left corner of a component, and if there is space, I'd...
6
by: Victor | last post by:
Hi all i have a css question about how to wrap a long text by using css. for example I have a very long text like "ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd" there...
1
by: vedika | last post by:
Hello, I have problem with word-wrapping. When width is given in pixel style="word-wrap:word-break" works well but when it is given in percentage then it is not working. <table border="1"...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.