<OPTION> No Longer Responds to onClick() or onSelect()

Discussion in 'Javascript' started by Hal Vaughan, Feb 17, 2004.

  1. Hal Vaughan

    Hal Vaughan Guest

    I'm using KDE on Linux, with Konqueror as the testing browser for this
    project. I've recently upgraded, so I realize some of the bugs I'm dealing
    with may or may not be my program, and could also result from me being less
    than perfect in my preliminary coding on test pages.

    I had an <OPTION> element, 10 lines in size. Previously I used:

    onclick="fillFields()"

    and when I clicked on a line in the <OPTION> element, the data was
    transferred into an input box below. Now when I try the same thing,
    nothing happens. I even replaced the original with:

    onclick="alert('got click')"

    and there was no response. I replaced "onclick" with "onselect", but it
    made no difference.

    Does this sound like a programming problem, events <OPTION> elements aren't
    supposed to respond to, or a bug in the newer version of the browser?

    The original HTML code is:

    <select size="10" name="selectFilterFields" onselect="fillFields()"
    style="font-family: monospace;">

    And the new code is:

    <select size="10" name="selectFilterFields" style="font-family: monospace;"
    onclick="alert('Selected!')">

    but neither version works. Am I doing something wrong?

    Thanks!

    Hal
    Hal Vaughan, Feb 17, 2004
    #1
    1. Advertising

  2. Hal Vaughan

    Hal Vaughan Guest

    I didn't realize I used <OPTION> instead of <SELECT> in the title and post.
    s/<OPTION>/<SELECT>/g.

    Oops...

    Hal Vaughan wrote:

    > I'm using KDE on Linux, with Konqueror as the testing browser for this
    > project. I've recently upgraded, so I realize some of the bugs I'm
    > dealing with may or may not be my program, and could also result from me
    > being less than perfect in my preliminary coding on test pages.
    >
    > I had an <OPTION> element, 10 lines in size. Previously I used:
    >
    > onclick="fillFields()"
    >
    > and when I clicked on a line in the <OPTION> element, the data was
    > transferred into an input box below. Now when I try the same thing,
    > nothing happens. I even replaced the original with:
    >
    > onclick="alert('got click')"
    >
    > and there was no response. I replaced "onclick" with "onselect", but it
    > made no difference.
    >
    > Does this sound like a programming problem, events <OPTION> elements
    > aren't supposed to respond to, or a bug in the newer version of the
    > browser?
    >
    > The original HTML code is:
    >
    > <select size="10" name="selectFilterFields" onselect="fillFields()"
    > style="font-family: monospace;">
    >
    > And the new code is:
    >
    > <select size="10" name="selectFilterFields" style="font-family:
    > monospace;" onclick="alert('Selected!')">
    >
    > but neither version works. Am I doing something wrong?
    >
    > Thanks!
    >
    > Hal
    Hal Vaughan, Feb 17, 2004
    #2
    1. Advertising

  3. Hal Vaughan

    Ivo Guest

    onfocus
    Ivo, Feb 17, 2004
    #3
  4. Hal Vaughan

    Hal Vaughan Guest

    Ivo wrote:

    > onfocus


    Thanks, but it doesn't work either (I just tried it). Absolutely NO
    response with onfocus.

    Is this more likely a browser issue than my programming? (Shouldn't
    onclick, onselect, and onfocus all work in this case?)

    Hal
    Hal Vaughan, Feb 17, 2004
    #4
  5. Hal Vaughan wrote:
    > Ivo wrote:
    >
    >> onfocus

    >
    > Thanks, but it doesn't work either (I just tried it). Absolutely NO
    > response with onfocus.


    onchange?

    --
    If the Internet is a Marx Brothers movie, and Web, e-mail, and IRC are
    Groucho, Chico, and Harpo, then Usenet is Zeppo.
    Berislav Lopac, Feb 17, 2004
    #5
  6. On Tue, 17 Feb 2004 06:35:55 GMT, Hal Vaughan <>
    wrote:

    [snip]

    > I had an <OPTION> [edit: SELECT] element, 10 lines in size.
    > Previously I used:
    >
    > onclick="fillFields()"
    >
    > and when I clicked on a line in the <OPTION> [edit: SELECT] element,
    > the data was transferred into an input box below. Now when I try
    > the same thing, nothing happens. I even replaced the original with:
    >
    > onclick="alert('got click')"
    >
    > and there was no response. I replaced "onclick" with "onselect", but
    > it made no difference.


    The onselect event is used when text is selected in an INPUT or TEXTAREA
    element, not when you select from a SELECT element.

    I just posted a solution to someone else's problem ("Calculated fields")
    which uses the onchange event on SELECT elements to update an INPUT, and
    it works in Opera, Mozilla, Netscape and IE (all WinXP). If onchange
    doesn't work for you, in similar usage, Konqueror is broken. However, if

    <select ... onclick="alert('a')">

    doesn't display 'a' on-click, it is equally broken.

    Mike

    --
    Michael Winter
    d (replace ".invalid" with ".uk" to reply)
    Michael Winter, Feb 17, 2004
    #6
  7. Hal Vaughan

    Eric Bohlman Guest

    Hal Vaughan <> wrote in
    news:fDiYb.48346$uV3.100005@attbi_s51:

    > I'm using KDE on Linux, with Konqueror as the testing browser for this
    > project. I've recently upgraded, so I realize some of the bugs I'm
    > dealing with may or may not be my program, and could also result from
    > me being less than perfect in my preliminary coding on test pages.
    >
    > I had an <OPTION> element, 10 lines in size. Previously I used:
    >
    > onclick="fillFields()"
    >
    > and when I clicked on a line in the <OPTION> element, the data was
    > transferred into an input box below. Now when I try the same thing,
    > nothing happens. I even replaced the original with:
    >
    > onclick="alert('got click')"
    >
    > and there was no response. I replaced "onclick" with "onselect", but
    > it made no difference.


    Have you run your HTML through a validator? If not, do so and fix any
    errors that it points up. It's often the case that new versions of
    browsers change the way they deal with invalid HTML, often causing
    something that "worked" in a previous version to fail in the new version.
    Plainly what's going on is that Konqueror isn't paying any attention to
    your action attributes (since your "alert" example is plainly correct
    Javascript); the reason may be that its parser is getting out of sync due
    to some invalid HTML. Come to think of it, make sure you haven't
    inadvertently disabled Javascript in the browser as well.
    Eric Bohlman, Feb 18, 2004
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roedy Green
    Replies:
    4
    Views:
    572
    Raymond DeCampo
    Aug 18, 2005
  2. Mark B
    Replies:
    1
    Views:
    847
    Mark B
    May 10, 2010
  3. Terry

    how about something simple but eludes me ->onselect ->post

    Terry, Sep 8, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    145
    Eliyahu Goldin
    Sep 8, 2004
  4. F. Da Costa
    Replies:
    3
    Views:
    98
  5. Rob Wahmann

    onselect open new window

    Rob Wahmann, Mar 5, 2004, in forum: Javascript
    Replies:
    7
    Views:
    140
    Randy Webb
    Mar 7, 2004
Loading...

Share This Page