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 ="100" topmargin ="50" MARGINHEIGHT="50" MARGINWIDTH="100" BGCOLOR="WHITE">
<FORM NAME="fm">
<SELECT NAME="no" 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="javascriptrderModule('u')">Up</A>
<P>
<A HREF="javascriptrderModule('d')">Down</A>
<P>
<SCRIPT>
function orderModule(direction)
{
ok2swap = false;
myElement = this.document.fm.no;
myIndex = myElement.selectedIndex;
if(direction=="u" && myIndex > 0)
{
mySwap = myIndex - 1;
ok2swap=true;
}
else if(direction == "d" && 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.
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 ="100" topmargin ="50" MARGINHEIGHT="50" MARGINWIDTH="100" BGCOLOR="WHITE">
<FORM NAME="fm">
<SELECT NAME="no" 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="javascriptrderModule('u')">Up</A>
<P>
<A HREF="javascriptrderModule('d')">Down</A>
<P>
<SCRIPT>
function orderModule(direction)
{
ok2swap = false;
myElement = this.document.fm.no;
myIndex = myElement.selectedIndex;
if(direction=="u" && myIndex > 0)
{
mySwap = myIndex - 1;
ok2swap=true;
}
else if(direction == "d" && 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.