PDA

View Full Version : next/previous buttons for drop menu


maverick
08-03-2002, 01:34 AM
I have a drop down menu with 20 options.

Is there a way to make a [NEXT] and [PREVIOUS] button to cycle back and forth through the list?

webmarkart
08-03-2002, 07:41 AM
to go back to the previous page:
<A HREF="javascript:history.go(-1)">Go Back</A>

the next one would depend on how you named your pages and what languages you are using.

joh6nn
08-03-2002, 08:25 AM
I'm not sure you can, Maverick. i have an idea of how it might be done, but it's late, and i'm real tired. i'll give it a try tomorrow, and post what i find.

webmarkart
08-03-2002, 08:30 AM
If you use asp, or another server side language and you named your pages numerically in sequential order you can simply have the next button link increment itself by one until it reaches the last page.

joh6nn
08-03-2002, 08:37 AM
webmark, he's talking about a select box, not the history.

webmarkart
08-03-2002, 08:40 AM
the original post must have been edited since I read it because I dont remember reading about a dropdown... regardless though it can be done with a server side language and maybe a small access db.

oracleguy
08-03-2002, 09:59 AM
I think i got it figured out. I tried to do it in Javascript but i couldnt get it to work but i got it to work with VBScript.


<HTML>
<HEAD>
<TITLE></TITLE>

<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
<!--

Sub Next_onclick
Dim strCurrentItem
strCurrentItem=ListBox1.selectedIndex
ListBox1.selectedIndex=strcurrentitem+1

End Sub

Sub Previous_onclick
Dim strCurrentItem
strCurrentItem=ListBox1.selectedIndex
ListBox1.selectedIndex=strcurrentitem-1
End Sub

-->
</SCRIPT>
</HEAD>
<BODY>

<P><INPUT id=Previous type=button value=Previous><BR>
<SELECT size=1 id="ListBox1" name="Listbox1"> <OPTION value="Test 1" selected
>Test 1</OPTION><OPTION value=2>Test 2</OPTION><OPTION
value=3>Test 3</OPTION><OPTION value=4>Test 4</OPTION></SELECT><BR><INPUT id=Next style="LEFT: 68px; TOP: 15px" type=button value=Next ></P>

</BODY>
</HTML>

:thumbsup:
No sever-side code... no database...