select: how to detect same option selected?

M

markus.rietzler

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>
 
R

Randy Webb

(e-mail address removed)-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?

<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......
 
C

Csaba Gabor

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.lang.javascript/browse_frm/thread/618645fa2fe904be/

Csaba Gabor from Vienna
 
M

markus.rietzler

@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
 
T

Thomas 'PointedEars' Lahn

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]
P.P.S.: Did you know that there is de.comp.lang.javascript?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top