java.qc@gmail.com
Joined: 29 May 2008 Posts: 3
|
Posted: Thu May 29, 2008 12:45 pm Post subject: Fixing the width of select box in IE |
|
|
Hi ,
I m facing the problem with fixing the width of select box on my html page but option list should be expended to a fix width as required. My problem is my select list should be fix but option list can expand .Attached is the code that is working fine on Mozila but on IE it is not working as required .Plz help me out to make it work properly on IE.
<html>
<script type="text/javascript">
<!-- begin hiding
function expandSELECT(sel)
{
sel.style.width = '200px';
}
function contractSELECT(sel) {
hi();
sel.style.width = '100px';
}
// end hiding -->
function hi()
{
for (var i = 0; i<document.forms[0].test.length;i++)
{
if(document.forms[0].test.options[i].selected== true)
{
document.forms[0].test.options[i].selected= true;
break;
}
}
}
</script>
<form>
<select name = "test" width="70" style="width: 100px";"position:absolute"; onfocus=expandSELECT(this)
onblur=contractSELECT(this) >
<option value="1">11111111111111111111111111111111111111111111
<option value="2">2222222222
<option value="3">3333333333333
<option value="4">444
</select>
</form>
</html>[/code] |
|