2nd click ineffective in drop-down list

B

Bernard Philip

hey everybody
i have a dropdown list opening a window, ie
<SELECT onchange=openwindow()..>
<OPTION value=....
<..choice1..>
<..choice2..>
when clicking on an choice

if i clear this window, and click again
on the same choice, nothing happens
i must click another choice, and then
come back on the first, which runs

any medicine to allow a 2nd click on the same choice ?

thnx a lot
sorry for my english
Bernard, from France
 
M

Martin Honnen

Bernard said:
hey everybody
i have a dropdown list opening a window, ie
<SELECT onchange=openwindow()..>
<OPTION value=....
<..choice1..>
<..choice2..>
when clicking on an choice

if i clear this window, and click again
on the same choice, nothing happens
i must click another choice, and then
come back on the first, which runs

any medicine to allow a 2nd click on the same choice ?

You could deselect the option
<select onchange="openwindow(); this.selectedIndex = -1;"
that way the user has to select the option again and the browsers
recognizes a change that triggers onchange.
 
L

Lasse Reichstein Nielsen

Martin Honnen said:
You could deselect the option
<select onchange="openwindow(); this.selectedIndex = -1;"
that way the user has to select the option again and the browsers
recognizes a change that triggers onchange.

And people navigating with a keyboard will be completely lost, not
just highly annoyed as by the original solution.

Don't overuse the onchange event on selectboxes, some people will have
to go through several choises before they reach the one they want.

/L
 
B

Bernard Philip

You could deselect the option
<select onchange="openwindow(); this.selectedIndex = -1;"
that way the user has to select the option again and the browsers
recognizes a change that triggers onchange.
thnx a lot for your quick answer, Martin,
and congratulations, it runs
(the name inside the dropdown-box
is blank the 2nd time, but it seems a small problem)

best regards
 
B

Bernard Philip

And people navigating with a keyboard will be completely lost, not
just highly annoyed as by the original solution.

Don't overuse the onchange event on selectboxes, some people will have
to go through several choises before they reach the one they want.
when using mouse only, the solution proposed by Martin seems ok for me
why do you use keyboard ? quicker ? mouse broken ?
regards
B.
 
B

Bernard Philip

Bernard said:
hey everybody
i have a dropdown list opening a window, ie
<SELECT onchange=openwindow()..>
<OPTION value=....
<..choice1..>
<..choice2..>
when clicking on an choice

if i clear this window, and click again
on the same choice, nothing happens
i must click another choice, and then
come back on the first, which runs

any medicine to allow a 2nd click on the same choice ?

With Netscape 6/7 and with Opera 7 you could use onclick instead of
onchange and do the following

<html>
<head>
<title>select and onclick</title>
<script type="text/javascript">
function showSelectedOption (select, evt) {
if (select != evt.target) {
var selectedOption = select.options[select.selectedIndex];
if (selectedOption) {
alert(selectedOption.text + '; ' + selectedOption.value);
}
}
}
</script>
</head>
<body>
<p>
<select onclick="showSelectedOption(this, event);">
<option value="http://www.kibo.com/">Visit GOD</option>
<option value="http://www.lancearmstrong.com/">Visit the bike GOD</option>
</select>
</p>
</body>
</html>

It doesn't work with IE however
IE is the target for my pages,
so I prefer your 1st solution (index=-1)

thnx again, Martin
Bernie, from Paris
 
R

Richard Hockey

Bernard Philip said:
when using mouse only, the solution proposed by Martin seems ok for me
why do you use keyboard ? quicker ? mouse broken ?

How about you are blind or partially sighted, and you use a screenreader to
access the web page, controlling it via the keyboard?
 
L

Lasse Reichstein Nielsen

Bernard Philip said:
when using mouse only, the solution proposed by Martin seems ok for me
why do you use keyboard ? quicker ? mouse broken ?
regards

I don't, but there are people who do. Some because they like it
better, others because they have a physical condition that prevents
them from using a mouse.

/L
 

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,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top