473,385 Members | 1,402 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,385 software developers and data experts.

select: how to detect same option selected?

onChange() is working very well, when an option is choosen the first
time. how can i detect when the user clicks and choose the same option
again?
this code works with IE 6.x. you can click the same option again and
again and the onChange()-event comes up.
firefox will react on the onmousedown but the onChange is not executed.

is there a way to detect selecting the same option again and again?

<html>
<head>
<script>
function selChange (feld) {
alert (feld.options[feld.selectedIndex].value);
}
</script>
</head>

<body>
<FORM>
<SELECT onmousedown="this.selectedIndex=-1; this.focus(); return
true;" onchange="selChange(this); return false;">
<OPTION VALUE="nop">Choose
<OPTION VALUE="1">one
<OPTION VALUE="2">two
<OPTION VALUE="3" selected>three
<OPTION VALUE="4">four
</SELECT>
</FORM>
</body>
</html>

Apr 23 '06 #1
4 6444
ma*************@rzf.fin-nrw.de said the following on 4/23/2006 9:28 AM:
onChange() is working very well, when an option is choosen the first
time. how can i detect when the user clicks and choose the same option
again?
this code works with IE 6.x. you can click the same option again and
again and the onChange()-event comes up.
firefox will react on the onmousedown but the onChange is not executed.

is there a way to detect selecting the same option again and again?
<snip>
<FORM>
<SELECT onmousedown="this.selectedIndex=-1; this.focus(); return
true;" onchange="selChange(this); return false;">


onmouseup = "selChange(this)"

I bet it makes keyboard navigation fun......

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 23 '06 #2
ma*************@rzf.fin-nrw.de wrote:
onChange() is working very well, when an option is choosen the first
time. how can i detect when the user clicks and choose the same option
again?
this code works with IE 6.x. you can click the same option again and
again and the onChange()-event comes up.
firefox will react on the onmousedown but the onChange is not executed.

is there a way to detect selecting the same option again and again?


Perhaps see this Aug 15, 2005 thread:
http://groups.google.com/group/comp....645fa2fe904be/

Csaba Gabor from Vienna
Apr 23 '06 #3
@randy: even with a mouse the select is not usable anymore.

@csaba: my problem is, that i want to react even if the same option is
selected again! say reload the page and send the "select-option-value"
again.

markus

Apr 23 '06 #4
ma*************@rzf.fin-nrw.de wrote:
onChange() is working very well, when an option is choosen the first
time. how can i detect when the user clicks and choose the same option
again?
this code works with IE 6.x. you can click the same option again and
again and the onChange()-event comes up.
firefox will react on the onmousedown but the onChange is not executed.

is there a way to detect selecting the same option again and again?
onclick. (However, don't use `select' elements for navigation without
fallback; use `ul' and a[href] elements instead.)
@randy: even with a mouse the select is not usable anymore.
I do not understand -- maybe because you did not quote anything.
See below.
[<html>...</html>]


<URL:http://validator.w3.org/>
PointedEars

P.S.
Please learn to post. Your current style does not do anyone any good:

[en] <URL:http://jibbering.com/faq/faq_notes/pots1.html>
[en] <URL:http://www.safalra.com/special/googlegroupsreply/>
[de] news:de-newusers-infos/google-poster/20********@krell.zikzak.de

P.P.S.: Did you know that there is de.comp.lang.javascript?
--
The English government is much of a German poodle as
other governments. The Germans infiltrated them all.
-- "The only real Barbara Schwarz", dsw.scientology,
<16**************************@posting.google.com >)
Apr 23 '06 #5

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

Similar topics

7
by: Felix Natter | last post by:
hi, I have a php-Script which gets passed a Boat-ID and this is used to mark an element in a <select> as the default: <select name="boote" multiple="multiple" size="5"> <option...
5
by: callmebill | last post by:
I'm relatively new to javascript, and I'm trying to decide whether the following (and if so, clues on how to do it): I'd like to create two HTML multiple-select boxes. The first would be a list...
1
by: smash2004 | last post by:
I want to keep selected values in select list when i click on another option...with a click on a mouse... if i have 3 options in select list and i click first option..it gets selected..if i then...
3
by: ANTISPAM_garycnew_ANTISPAM | last post by:
What is the simplest way to retain the last option value selected in an html select object using javascript? I am currently using a server-side cgi language to accomplish this task, but it adds...
4
by: rn5a | last post by:
A Form has 2 select lists. The 1st one whose size is 5 (meaning 5 options are shown at any given time) allows multiple selection whereas the 2nd one allows only 1 option to be selected at a time. ...
5
by: chaos | last post by:
Hi , I stuck in my project as i face a problem How to show the available time of the venue when i select the day?? Need to connect to the database to find out the available time of the venue on...
2
by: Sudhakar | last post by:
i have two select tags as part of a registration form, city1 city2 where city1 has a list of regions and similar for city2 there are different regions for city1 and city2 so instead of all the...
6
by: phpnewbie26 | last post by:
My current form has one multiple select drop down menu as well as few other drop down menus that are single select. Originally I had it so that the multiple select menu was first, but this created...
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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?

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.