Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select box question

Status
Not open for further replies.

skiflyer

Programmer
Sep 24, 2002
2,213
US
I have a select box, I want it to start how it is, but when the user clicks to expand it, I want it to expand farther than it does... could someone tell me which tag I need?

I tried size=60, but that just started it at 60, which is no good.

-Rob
 
Select boxes are generally tied to the amount of text in each option. Unfortunately, there is no easy remedy for this but you might try something using CSS. Good luck! There's always a better way...
 
maybe you could use a javascript: try something like this:

<a href=&quot;#&quot; onClick=&quot;<NameOfSelect>.size = 200;&quot;> resize </a>

i dont know if it works, ive never tried anything
like that though.

I hope this helped, [bobafett] BobbaFet [bobafett]

Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com
 
Unfortunately that has the same affect as using the size tag, namely it blows the whole box up causing the form to get whacked out of shape... thanks for trying though.

-Rob

 
Do you mean something like this:

<script language=&quot;javascript&quot;>
function changeWidth()
{
document.MyForm.selectboxname.style.width = '300px';
document.MyForm.selectboxname.focus();
}</script>


<form name=&quot;MyForm&quot;>
<SELECT style=&quot;width:105px&quot; onMousedown=&quot;changeWidth()&quot; name=&quot;selectboxname&quot; SIZE=&quot;1&quot;>

<OPTION value=&quot;none&quot; selected>-Select Here-</OPTION>
<OPTION VALUE=&quot;<OPTION VALUE=&quot;<option value=&quot;a&quot;>something goes here</option>
<option value=&quot;b&quot;>something goes here 2</option>
</SELECT><br><br>
</form>

You can also add a reset function to the <SELECT> tag:

<SELECT style=&quot;width:105px&quot; onmousedown=&quot;changeWidth()&quot; onchange=&quot;resetWidth()&quot; name=&quot;selectboxname&quot; SIZE=&quot;1&quot;>

<script language=&quot;javascript&quot;>
function changeWidth()
{
document.MyForm.selectboxname.style.width = '300px';
document.MyForm.selectboxname.focus();
}


function resetWidth()
{
document.MyForm.selectboxname.style.width = '105px';
}

</script>

Hope this helps,
Erik <-- My sport: Boomerang throwing !!
!! Many Happy Returns !! -->
 
In my previous post I assumed you ment to expand horizontal.
If you want to expand vertical then use these functions:

function changeWidth()
{
document.MyForm.selectboxname.style.width = '300px';
document.MyForm.selectboxname.size = '7';
document.MyForm.selectboxname.focus();
}

function resetWidth()
{
document.MyForm.selectboxname.style.width = '105px';
document.MyForm.selectboxname.size = '1';
}

Hope this helps,
Erik
<-- My sport: Boomerang throwing !!
!! Many Happy Returns !! -->
 
Not exactly, that approach would actually resize the box and change the look of the whole change in the process.

What I want to have control over is the size of the dropdrown list, not the size of the active area.

-Rob
 
Isn't that controled by the browser only? I could be wrong, but I think the max in IE 5 is 11 rows, and it's much more in IE 6.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top