Thanks pcx99 and Randy for your reply and information.
If possible, I would like to avoid using iframe because there will be
too much amendment I have to do in my application.
The main problem I am facing right now is that the width I can assign
for each listbox is limited, but the text contents of each items in
listbox is pretty long. Thus, it will be hard for user to select items
that looks the similar.
First, I thought of using tooltip to assist user to select, but then I
got another simpler idea by using <span> to wrap the <select> tag. I
just set the <span> width to a certain value, and not restricting the
width in the <select> part.
Please take a look at the sample code below (tested in MSIE 6.0):
<!-- start sample code -->
<html>
<script>
function setLabelSpan(element){
var label = document.getElementById('labelSpan');
label.innerHTML=element.options[element.selectedIndex].text;
}
function setLabelNoSpan(element){
var label = document.getElementById('labelNoSpan');
label.innerHTML=element.options[element.selectedIndex].text;
}
</script>
<body>
<form >
<table border="1" bordercolor="#000000">
<tr>
<td nowrap>Using Span </td>
<td><span style="overflow:hidden;width:150px">
<select name="select" border=0 onchange="setLabelSpan(this)">
<option value="">Select Product Code</option>
<option value="100">AE000 : Johnson's Baby Lotion (A/V)(G) -
100mlx24 </option>
<option value="101">AE001 : Johnson's Baby Lotion (A/V)(G) -
200mlx24 </option>
<option value="102">AE002 : Johnson's Baby Lotion (A/V)(G) -
400mlx24 </option>
<option value="103">AE003 : Johnson's Baby Lotion (A/V)(G) -
800mlx24 </option>
<option value="104">AE004 : Johnson's Baby Lotion (A/V)(G) -
100mlx72 </option>
<option value="105">AE005 : Johnson's Baby Lotion (A/V)(G) -
200mlx72 </option>
<option value="106">AE006 : Johnson's Baby Lotion (A/V)(G) -
400mlx72 </option>
<option value="107">AE007 : Johnson's Baby Lotion (A/V)(G) -
800mlx72 </option>
<option value="108">AE008 : Johnson's Baby Lotion (A/V)(N) -
100mlx24 </option>
<option value="109">AE009 : Johnson's Baby Lotion (A/V)(N) -
200mlx24 </option>
<option value="110">AE010 : Johnson's Baby Lotion (A/V)(N) -
400mlx24 </option>
<option value="111">AE011 : Johnson's Baby Lotion (A/V)(N) -
800mlx24 </option>
<option value="112">AE012 : Johnson's Baby Lotion (A/V)(N) -
100mlx72 </option>
<option value="113">AE013 : Johnson's Baby Lotion (A/V)(N) -
200mlx72 </option>
<option value="114">AE014 : Johnson's Baby Lotion (A/V)(N) -
400mlx72 </option>
<option value="115">AE015 : Johnson's Baby Lotion (A/V)(N) -
800mlx72 </option>
</select>
</span> </td>
</tr>
<tr>
<td nowrap>Without Span </td>
<td>
<select name="select" style="overflow:hidden;width:150px" border=0
onchange="setLabelNoSpan(this)">
<option value="">Select Product Code</option>
<option value="100">AE000 : Johnson's Baby Lotion (A/V)(G) -
100mlx24 </option>
<option value="101">AE001 : Johnson's Baby Lotion (A/V)(G) -
200mlx24 </option>
<option value="102">AE002 : Johnson's Baby Lotion (A/V)(G) -
400mlx24 </option>
<option value="103">AE003 : Johnson's Baby Lotion (A/V)(G) -
800mlx24 </option>
<option value="104">AE004 : Johnson's Baby Lotion (A/V)(G) -
100mlx72 </option>
<option value="105">AE005 : Johnson's Baby Lotion (A/V)(G) -
200mlx72 </option>
<option value="106">AE006 : Johnson's Baby Lotion (A/V)(G) -
400mlx72 </option>
<option value="107">AE007 : Johnson's Baby Lotion (A/V)(G) -
800mlx72 </option>
<option value="108">AE008 : Johnson's Baby Lotion (A/V)(N) -
100mlx24 </option>
<option value="109">AE009 : Johnson's Baby Lotion (A/V)(N) -
200mlx24 </option>
<option value="110">AE010 : Johnson's Baby Lotion (A/V)(N) -
400mlx24 </option>
<option value="111">AE011 : Johnson's Baby Lotion (A/V)(N) -
800mlx24 </option>
<option value="112">AE012 : Johnson's Baby Lotion (A/V)(N) -
100mlx72 </option>
<option value="113">AE013 : Johnson's Baby Lotion (A/V)(N) -
200mlx72 </option>
<option value="114">AE014 : Johnson's Baby Lotion (A/V)(N) -
400mlx72 </option>
<option value="115">AE015 : Johnson's Baby Lotion (A/V)(N) -
800mlx72 </option>
</select>
</td>
</tr>
</table>
<br> Selected Value using span = <span id="labelSpan"></span>
<br> Selected Value without span = <span id="labelNoSpan"></span>
</form>
</body>
</html>
<!-- end sample code -->
The row 'without span' in the table is what the original looks like, and
row 'using span' is after using the span.
I hope this one idea can help another people too.
thanks,
hiroshi
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!