onclick event not working in IE7

T

Thomas 'PointedEars' Lahn

Henri said:
On my web site, I have a <select> drop-down menu that allows to show/
hide divs: http://tchernobyl.dreamhosters.com - The problem is that it
doesn't work in IE7 (only tested in Opera and Firefox). However, if I
include the onclick event in an <a> tag, it works fine in IE (but not
within <option> tags). Next to the drop-down menu, I put a "test" link
which works fine in IE7. [...]

Please trim your quotes as explained in the FAQ.
it won't work that way: you cannot associate any event to the <option>
tag.

If you would have read what was posted (more than 12 hours) before, you
would have known that this is plain wrong. First, it is an option
_element_. Second, several event types apply to the `option' element, and
it has corresponding intrinsic event handler attributes in Valid (X)HTML.
It is only that the MSHTML DOM disregards Web standards here.
Attach it to the <select> tag instead; and the event should be
onchange as in onchange="showdiv(this.options[this.selectedIndex].value);"

However, that is _not_ an equivalent solution as showdiv() will then only be
called when the control's value *changes*; not always when an option was
clicked.


PointedEars
 
D

David Mark

A <select> with only one <option> can be perfectly valid and
desirable. I can't think of a reason what would be the problem with

Valid, but hardly desirable from an interface standpoint. Regardless,
the other thread that triggered this one-option-per-select argument
related a single-option select that had to be clicked to fill in a
hidden input. Clearly the single-option select should have been a
hidden input in the first place. Requiring the user to click a select
with one option as a "workaround" for a poor interface design is not
acceptable.
 
B

Bart Van der Donck

David said:
Valid, but hardly desirable from an interface standpoint. Regardless,
the other thread that triggered this one-option-per-select argument
related a single-option select that had to be clicked to fill in a
hidden input. Clearly the single-option select should have been a
hidden input in the first place. Requiring the user to click a select
with one option as a "workaround" for a poor interface design is not
acceptable.

Generally spoken, I think one-option-selects are acceptable in select-
lists that depend on some kind of previous filter (set by the user, by
the available data, ...). If there is no such filter, the nature of
this elements make it a bit odd to use only one option.
 
L

Lee

The Natural Philosopher said:
God, another religious pervert.

And hpow paty, wre borswer intended to be used?

If you look at what they are used for these days, and compare with the
original intention - the sharing of reasearch papers across the net,
then javascript itself is 'wrong'

Do you not understand the difference between a browser and
a browser element?

Oh my gawd.

I bet all our barbecues are very expensive, and run of bottled gas, and
you have never punched holes in an oil drum and fill it full of wood to
cook our steaks. "Wrong use of an oildrum".

Thank heavens yy weren;t there when someone forst used a log to roll a
stone down a slope 'wrong use of a log'

Your analogies are badly flawed, suggesting that you've missed
the point.

If, for example, you punched holes in an oil drum and filled it
full of wood and set it a storage room full of drums filled with
oil, that would be "wrong use of an oil drum", because it would
cause confusion to the users and create a headache for whoever
is responsible for maintaining that storage room.

I can tell you are PROBABLY some snotty computer scuentist escaped from
college.

I've been a software engineer working in the real world for (I
would assume) most of your lifetime.

I am an engineer: there is no right or wrong, there is what works, and
what doesn't. All engineering is the exploitation of unexpected
properties of the material world to achieve a specific aim.

Engineering also involves considering more than functionality.
You must consider usability, stability, maintainability,
portability, and a host of other "-ilities" that go far beyond
function. If you don't consider them, you're not an engineer.

If I want to put a single line of clickable text in a box that looks
like the multiple lines of clickable text in he other select boxes, that
is not WRONG.

If you implement it as a single option select control and have to
write hack code to make it work as you intend, and have to explain
to the users that this select control, unlike any other they've
used, actually functions like a pushbutton, then yes, it's wrong.

Using javascript with form input elements in *every* case is NOT what
the designers of form elements ever intended. Strictly one ought to
throw away the form elements and do the thing in pure javascript, but
that is non standard across browsers in so many ways..

Modern browsers were written with the intention of allowing
interaction with Javascript. They weren't written with the
intention that self-styled engineers would pervert the basic
usage models.

That is not what this code does. It splits options from a very long list
into sub lists, simply t make it easier to find the right option without
yards of scrolling.

On occasion, some of those sub lists contain just one element.

Then that is, indeed, "what this code does".

Yawn. YOU write some code that allows selection of *one* item and one
alone from several drop down lists one or more of which may contain only
one element.

Have you considered that drop down lists may not be the best
user interface for this task?

I found a way that has a consistent look and feel and works in all
browsers.

As an engineer, that is all I ask.

Then you're not an engineer.

That goes for almost everything one ever writes.

Are you saying that it isn't obvious to you that writing code to
make controls work in ways that they weren't intended to work is
inherently more likely to a maintenance issue?

MM. Unlikely in all cases. Since the use to which this particular form
is put involves the ability to draw CAD files. And deaf dumb and blind
idiots may be be able to play pinball, but they are remarkably rare in
CAD drafting.

You don't have to be deaf, dumb or blind to require accommodations.
I've known people to use CAD tools on special monitors and with
special input devices as accommodations.

Feel free to write me the 'proper' version..right now I have about
another 20 screens of code to write and no time frankly.

Don't worry. You, or your successor, will wind up writing it
correctly sooner or later.


--
 
L

Lee

Bart Van der Donck said:
A <select> with only one <option> can be perfectly valid and
desirable. I can't think of a reason what would be the problem with
that.

A select list with one element might be considered valid
(but I won't concede "desirable") in the case where it
functions to show that there is only one choice available
which will be submitted when the user submits the form.

It's certainly not valid when the user interface requires
the user to click on that single option, as in the case
that is being defended.


--
 
T

The Natural Philosopher

Randy said:
The Natural Philosopher said the following on 10/9/2007 5:39 AM:

I keep forgetting that I shouldn't try to get someone that displays the
intelligence level you display to understand a simple concept such as
common sense.

That is really funny, but I won;t tell you why.
 
T

The Natural Philosopher

Lee said:
The Natural Philosopher said:

I've been a software engineer working in the real world for (I
would assume) most of your lifetime.

Mm. Lets see. Half of my life takes us to 1978. I guess MOST of my life
would take us back to 1970...I guess its JUST possible that you have
been programming computers since then , but I doubt it.
 
L

Lee

The Natural Philosopher said:
Mm. Lets see. Half of my life takes us to 1978. I guess MOST of my life
would take us back to 1970...I guess its JUST possible that you have
been programming computers since then , but I doubt it.

If half of your life takes us to 1978, then MOST of your
life also takes us to 1978, genius, at which time I was
developing 8080 assembly code for my employer's office
automation system, but it wasn't until about 1980 that I
had "software engineer" in my job title, so you can have
that as a victory, if you like.


--
 

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

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top