473,397 Members | 2,099 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,397 software developers and data experts.

Javascript dropdown - dynamic width text, static length control

Hi All!

Has anyone seen an example of the following javascript powered control:
- a dropdown select menu
- the width of the control is set. Assume by "control" I mean the visible
part of the drop down before a mouse click occurs.
- the width of the list when selected is dynamic
- the width of the list can grow beyond the width of the control without
changing the width of the control.

Kind regards,

Rob
:)
Jul 23 '05 #1
3 10718
Robert Mark Bram wrote:
Hi All!

Has anyone seen an example of the following javascript powered control:
- a dropdown select menu
Why do you need javascript when HTML accomplishes that?
- the width of the control is set. Assume by "control" I mean the visible
part of the drop down before a mouse click occurs.
That happens with plain HTML <select> elements. It assumes the width of
the widest/longest text in the options.
- the width of the list when selected is dynamic
dynamic depending on what?
- the width of the list can grow beyond the width of the control without
changing the width of the control.


How do you propose to change its width without changing its width?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #2
Hi Randy,

Thanks for the response. I will answer your questions as best I can, though
I feel you may not be satisfied with my attempt. :)
Has anyone seen an example of the following javascript powered control:
- a dropdown select menu


Why do you need javascript when HTML accomplishes that?
- the width of the list when selected is dynamic


dynamic depending on what?
- the width of the list can grow beyond the width of the control without
changing the width of the control.


How do you propose to change its width without changing its width?


I know how HTML select controls work and I am asking for something slightly
different.

The issue is that I need a select control whose width doesn't change: it
needs to have a static i.e. unchanging width that in most cases will be
narrower than the text contained in the widest option. This is something I
have done with VB on an Access form.

The design I have been asked to create involves a 'grid' of select controls,
all of which are the same size, no matter what text their options contain. I
understand if this sounds silly or unreasonable to you, but I am not asking
for design advice. I am only asking if anyone has seen a previous Javascript
example of this.
My idea here is to use Javascript to render the list when the user clicks
the drop down button, effectively meaning the <select> element would need to
be separate from the <option> elements. Most likely the solution would use a
text field and a graphic to 'fake' the drop down and render the list as a
layer.

Kind regards,

Rob
:)
Jul 23 '05 #3
Robert Mark Bram wrote:
Hi Randy,

Thanks for the response. I will answer your questions as best I can, though
I feel you may not be satisfied with my attempt. :)

Has anyone seen an example of the following javascript powered control:
- a dropdown select menu
Why do you need javascript when HTML accomplishes that?

- the width of the list when selected is dynamic


dynamic depending on what?

- the width of the list can grow beyond the width of the control without
changing the width of the control.


How do you propose to change its width without changing its width?

I know how HTML select controls work and I am asking for something slightly
different.


Fair enough.
The design I have been asked to create involves a 'grid' of select controls,
all of which are the same size, no matter what text their options contain. I
understand if this sounds silly or unreasonable to you, but I am not asking
for design advice. I am only asking if anyone has seen a previous Javascript
example of this.

My idea here is to use Javascript to render the list when the user clicks
the drop down button, effectively meaning the <select> element would need to
be separate from the <option> elements. Most likely the solution would use a
text field and a graphic to 'fake' the drop down and render the list as a
layer.


A text field wouldn't duplicate the complete functionality of a select,
but you already know that. With a select you can select one and then
arrow key through the selections. What you might be able to try instead
of rolling your own is look into possibly controlling the width (display
width) with CSS. Or, truncating the length of the select options .text

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #4

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

Similar topics

4
by: JesusFreak | last post by:
From: us_traveller@yahoo.com (JesusFreak) Newsgroups: microsoft.public.scripting.jscript Subject: toolbar script problem NNTP-Posting-Host: 192.92.126.136 Recently, I downloaded the following...
7
by: Bil Muh | last post by:
Esteemede Developers, I would like to Thank All of You in advance for your sincere guidances. I am developing a software using Visual C++ .NET Standard Edition with Windows Form (.NET)...
1
by: Jorge Ponte | last post by:
hi I have a Web User Control (ascx) - lets call it "My_WUC" - in a Web form. In that WUC I want have a textbox and a button. I want to click on the button and open a popup (I use javascript for...
4
by: John Boy | last post by:
Hi, Can anyone help. This is really doing my nut in. 3 years ASP exp. and now doing .DOT which is a step in the wrong direction. Basically I am left with the code of a guy who has left. When I...
3
by: jimmygoogle | last post by:
I posted earlier with a scope problem. I think I resolved it in IE but in Firefox it still exists. Anyone have any ideas/experience with this? I attached my code sorry it is so long. You can...
7
by: julian.tklim | last post by:
Hi, I need to build an editable Datagrid with add & delete buttons on each row using javascript. DataGrid need not be pre-populated with values. To make the thing complicated, one of the...
12
by: tim | last post by:
I am using foldoutmenu 3 and am having problems with viewing my menus in firefox. On my sub3 menus i have more than one line of text in some places. firefox does not recognise that there is more...
2
by: verci | last post by:
Hi guys, sorry if this seems stupid but I'm a newbie, I'm running Windows XP Pro SP2, IE 7, VS2005, ASP.net 2.0 The problem is that I'm trying to display this news scroller made in a Javascript...
4
by: emily224 | last post by:
Hello, I have been trying to understand this source code, which I retreived from my online course test. I would like to know how to find the answer for the question on the test. Im sure the answer...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.