473,378 Members | 1,333 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,378 software developers and data experts.

VB combo box behaviour in HTML

A couple of times I have had to implement a VB style combo box (i.e.
text entry or drop down selection) under IE. I keep having to recreate
the following code from scratch, so I thought I'd post it here to help
myself and possibly others in the future.

....
<span style="width:100px; height:22px;">
<input id="text1" type="text" value="parrot"
style="width:100px; position:absolute; z-index:3;" />
<select style="width:100px; position:absolute; z-index:1;"
onmousedown="for (var i = options.length; i > 0 && text1.value !=
options[--i].text;); selectedIndex = i;"
onchange="text1.value = options[selectedIndex].text;">
<option />
<option>cat</option>
<option>dog</option>
</select>
<iframe frameborder="no" scrolling="no"
style="width:82px; height: 100%; position:absolute;
z-index:2;"></iframe>
&nbsp;
</span>
....

The "control" works with standard font sizes, and obeys in-line
placement rules.

The iframe serves to mask the text area of the windowed select element
(which otherwise doesn't obey its z-index).

The &nbsp; seems to be required with IE to give correct vertical
alignment to the span.

The next improvement would be to script the width settings from the
containing span, and adapt it for multi-browser (presumably with
various factors for the drop-button width). Maybe someone else might do
this and repost.

///

Jul 24 '05 #1
0 2304

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

Similar topics

4
by: Yuk Cheng | last post by:
<<<start index.htm>>> <html> <head> <script> function perform(action){ } </script> </head>
14
by: Rowland Shaw | last post by:
I've got a databound combo (databound to a System.Data.DataTable), but some rather unpredicatable behaviour -- even though I have 8 rows in the source table, only the first 6 are showing up in the...
7
by: Hans Merkl | last post by:
Hi, Can anybody recommend a combo box control (textfield + dropdown list) for ASP.NET? I have looked at some products and it seems they all have some problems. I haven't yet found a combo box...
2
by: billelev | last post by:
I have a form with two combo boxes. The first, cboAccount, allows a user to select an account. Ideally, the second combo box, cboSubAccount, will allow the user to select a Sub Account from a list...
4
by: virtualgreek | last post by:
Dear All, First of all I would like to take the time to thank you all for your efforts and time spent at this wonderful forum. I have found it very helpful with numerous examples available for...
2
by: cyberdwarf | last post by:
Hi! I have inherited a continuous form whose detail area contains two combo boxes. The rowsource of the 2nd combo depends on the selection made in the 1st, and is rebuilt in the GotFocus event of...
1
by: sierra7 | last post by:
Hi all One of my users is complaining that when she types in a combo box, instead of matching characters and over-typing, she seems to be inserting e.g. On entering the combo she types her first...
9
by: prakashwadhwani | last post by:
I have an unbound combo box in the form header. I have used an input mask "CCCC" 40 times to limit the max number of characters to 40. When I tab into the combo box & press a character say "K"...
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...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.