473,382 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Next/prev in html <select> list

I have a <selectlist in some html code with hundreds of options. Is it
possible to use javascript to jump to the next/previous item in the list?

Knut-Frode
Aug 16 '06 #1
1 2252
Lee wrote:
Knut-Frode Dagestad said:
>>I have a <selectlist in some html code with hundreds of options. Is it
possible to use javascript to jump to the next/previous item in the list?


Yes.

'Yes' is correct answer!
The solution is the following:

<...in the html-code...>
<input type="button" value="Up" onclick="shiftOps(selectname, -1)">
<input type="button" value="Down" onclick="shiftOps(selectname, 1)">

<...in the javascript-code....>
function shiftOps(sEl, n) {
sEl.selectedIndex = sEl.selectedIndex + n;
sEl.focus();
}
Aug 16 '06 #2

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

Similar topics

5
by: Brian Foley | last post by:
Hello, I am used to using the label tag with check boxes and radio buttons in html forms. This allows me to click on the text of the label to activate/deactivate the check box / button, rather...
4
by: Glen K | last post by:
The following works in Firefox buy not in Internet Explorer: <select> <option> option1 </option> <option style="font-style: bold"> option2 </option> </select> Are there any workarounds to...
14
by: xxbmichae1 | last post by:
I have a <select> object that i've set up an onchange event that fires in IE fine when I use the cursor up and down in the list, but If I use the cursor up and down in Firefox the event doesn't...
6
by: Chris Fink | last post by:
Does anyone know it is possible to include a small image(.gif .jpeg) within a <SELECT><option> so that the user would see the option text as well as a little image(icon) in the option? I know this...
4
by: VK | last post by:
I'm looking for autoexpand <select> list onfocus and collapse it back onselect/onblur (the list is select-one type) I know it is not possible directly, but I've seen here a hack by changing...
5
by: andreas.maurer1971 | last post by:
Hi everybody, I nearly get despaired of the fact that the events I chose and, according to the MSDN site, are correct, don't fire reliable in IE6. Is someone able to tell me, which events I can...
2
by: PW | last post by:
Is it possible to make a select list item red based on a condition ? TIA, PW
0
by: ajos | last post by:
hi friends, Im currently having a <html:select> where ive got many options value inside it...for example---> <html:select property="branch" size="1"> <html:option value="New...
2
by: pedalpete | last post by:
Hi All, I find this incredibly strange, but ie7 my html select list is being blocked by the pop-up blocker. Not sure why this is, and so far doing a search hasn't pointed me to an answer. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.