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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select box scrolling in NETSCAPE only !!!

Status
Not open for further replies.

rcsen

Programmer
Jan 11, 2001
51
US
Hi,

Is there any way to display the "selected" option in a SELECT box in NETSCAPE only on TOP?

Actually, this works fine in IE.
Scenario is:::

The size of the select is 5.

We have 10 options in the select box.

So, we'll be able to see only 5 options in the page and the rest can be scrolled. (Fine).

But what I am doing is,
Whenever, I click the links UP or DOWN, present in the page, the options will be moved up or down respectively in the SELECT box.

The problem is,
If I try to move down the 5th option, the code works fine and the option goes to the 6th position but the scroll bar doesn't move down and hence the selected option is not visible in the page without scrolling.. (ONLY NETSCAPE)
IE is fine.
Actually, you can find the difference when you try move down the 5th option in IE and NETSCAPE.

THE SAMPLE CODE IS ::::


<HTML>
<HEAD>

<title>TEST CODE</title>


<BODY leftmargin =&quot;100&quot; topmargin =&quot;50&quot; MARGINHEIGHT=&quot;50&quot; MARGINWIDTH=&quot;100&quot; BGCOLOR=&quot;WHITE&quot;>


<FORM NAME=&quot;fm&quot;>

<SELECT NAME=&quot;no&quot; SIZE=5>
<OPTION VALUE=10>TEST1</OPTION>
<OPTION VALUE=11>TEST2</OPTION>
<OPTION VALUE=12>TEST3</OPTION>
<OPTION VALUE=13>TEST4</OPTION>
<OPTION VALUE=14>TEST5</OPTION>
<OPTION VALUE=15>TEST6</OPTION>
<OPTION VALUE=16>TEST7</OPTION>
<OPTION VALUE=17>TEST8</OPTION>
<OPTION VALUE=18 SELECTED>TEST9</OPTION>
</SELECT>



</FORM>



<P>
<A HREF=&quot;javascript:eek:rderModule('u')&quot;>Up</A>
<P>
<A HREF=&quot;javascript:eek:rderModule('d')&quot;>Down</A>
<P>


<SCRIPT>

function orderModule(direction)
{
ok2swap = false;

myElement = this.document.fm.no;
myIndex = myElement.selectedIndex;

if(direction==&quot;u&quot; && myIndex > 0)
{
mySwap = myIndex - 1;
ok2swap=true;
}

else if(direction == &quot;d&quot; && myElement.selectedIndex < myElement.length)
{
mySwap = myIndex +1
ok2swap=true;
}


if(ok2swap)
{
myTempValue = this.document.fm.no.options[myIndex].value
myTempText = this.document.fm.no.options[myIndex].text

this.document.fm.no.options[myIndex].value = this.document.fm.no.options[mySwap].value
this.document.fm.no.options[myIndex].text = this.document.fm.no.options[mySwap].text


this.document.fm.no.options[mySwap].value = myTempValue
this.document.fm.no.options[mySwap].text = myTempText

this.document.fm.no.selectedIndex = mySwap
}
}


</SCRIPT>
</body>
</html>


############

I couldn't find any attribute or way to solve this.

If there is a way to solve this, please post it.

Thanks in advance for your precious time.

RCSEN.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top