472,978 Members | 2,121 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,978 software developers and data experts.

SELECT drop down list - SKIP

I have an drop down list

let say:

<SELECT name="id" id="id" OnClick="Skip()">
<option value="0"></option>
<option value="1">Item 1</option>
<option value="2">Item 2</option>
<option value="3">Item 3</option>
<option value="4">Item 4</option>
</SELECT>


I have a skip button (with the OnClick javascript function, whenever I click
skip, the drop down list will select the next Item of the current one.

Example:
- the current selected item is Item 2, when click Skip, it will select Item
3
- the current selected item is Item 3, when click Skip, it will select Item
4
- the current selected item is Item 4, when click Skip, it will select the
first one, which is Value 0

like a circle...

how to do that in javascript ?
<Script language="javascript">

function skip()
{

}
</script>

thanks.

Mar 19 '07 #1
2 3185
On Mar 19, 12:54 pm, "magix" <m...@asia.comwrote:
I have an drop down list
I have a skip button (with the OnClick javascript function, whenever I click
skip, the drop down list will select the next Item of the current one.

great. what is the question ?

like a circle...
>
how to do that in javascript ?
if you already have the function then why you are asking.

html-
<SELECT id="idSel">
<option value="0">Item 0</option>
<option value="1">Item 1</option>
<option value="2">Item 2</option>
<option value="3">Item 3</option>
<option value="4">Item 4</option>
</SELECT><br>
<button onclick="Next()"Select Next </button>

JavaScript-
function Next(){
var SelEct=document.getElementById("idSel")
var Curr=SelEct.selectedIndex
SelEct.selectedIndex=(Curr<(SelEct.options.length-1))?++Curr:0
}

Mar 19 '07 #2
On Mar 20, 5:27 am, scripts.cont...@gmail.com wrote:
On Mar 19, 12:54 pm, "magix" <m...@asia.comwrote:
I have an drop down list
I have a skip button (with the OnClick javascript function, whenever I click
skip, the drop down list will select the next Item of the current one.
[...]
how to do that in javascript ?
[...]
>
JavaScript-
function Next(){
var SelEct=document.getElementById("idSel")
var Curr=SelEct.selectedIndex
SelEct.selectedIndex=(Curr<(SelEct.options.length-1))?++Curr:0

}
How about:

function nextOption(sel) {
var idx = sel.selectedIndex;
sel.selectedIndex = ++idx % sel.options.length;
}
--
Rob

Mar 19 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Diane Yocom | last post by:
Has anybody ever seen or written code for ASP that would mimic Access' multi-column combo box? Specifically, I have a drop down box that lists about 100 five-digit codes. Each of these codes has...
1
by: Rod Early | last post by:
I need to know when the select element's dropdown list is opened (as when the user clicks on the arrow or does ALT-downarrow from the keyboard). Similarly, I need to known when the dropdown list...
1
by: Julia Briggs | last post by:
Hello, is there anyway to insert an image on any particular <select> option line in a drop down list without using a specialty drop-down? Any good ones out there that can be made to resemble a...
3
by: Darren | last post by:
Please Help Me!! I've created a typical <form> and a <select> element. The options are created dynamically from my access database (using asp). There are about 70 options, and when you click...
4
by: Therese A. Sorna | last post by:
Hello all... I am using Access 2002, and am trying to find a way for a user to be able to select multiple entries from a drop-down list. I am hoping that given a list as such: a b c d
2
by: hypomite | last post by:
I have an handler for the SelectedIndexChanged event of a dropdown box. I have also set the AutoPostBack option to True. When you select any item besides the first one, the event sucessfully fires....
13
by: Oliver Hauger | last post by:
Hello, In my html form I show a select-element and if this element is clicked I fill it per JavaScript/DOM with option-elements. I use the following code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD...
2
by: crazychrisy54 | last post by:
Hi there I have a option, select drop down list which a user can open. My page however refreshes very frequently and when this occurs the selected drop down list will pop back up. The user then...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.