JavaScript not working in IE and Safari, works in Firefox fine.

Discussion in 'Javascript' started by dpodkuik, Feb 17, 2006.

  1. dpodkuik

    dpodkuik Guest

    I have a simple function that does submit for me:

    <script language="javascript" type="text/javascript">
    function sort()
    //selected item value from the drop down list

    var dud=window.document.statusForm.sortByStaff.value;

    I have several drop down boxes (<select> element) in which i set
    onclick="sort()". Works perfectly in Firefox, and doesn't work in IE
    and Safari. Also this same function works fine in all 3 if appended to
    a button instead of select element. What am I doing wrong?
    dpodkuik, Feb 17, 2006
    1. Advertisements

  2. dpodkuik

    dpodkuik Guest

    I have simplified the function based on your advice, but still was only
    able to obtain result in Firefox with onclick set instead of onchange.
    When I use onchage nothing works anywhere.

    function sortStaff(action)


    <select name="staff"

    I am not switching from POST to GET so I just moved method into form
    declaration from javascript.
    dpodkuik, Feb 17, 2006
    1. Advertisements

  3. dpodkuik

    dpodkuik Guest

    He he

    Ok, i found all the dumb things I did. onchange doesn't work when
    attached to options :). Moved to element declaration and everything
    works fine.
    IE doesn't support onclick and i guess safari doesn't either.
    dpodkuik, Feb 17, 2006
  4. JFYI: /That/ is _not_ called an (element) declaration:

    <select name="staff" onchange="...">

    It is called the start tag of the `select' element.

    This is called an element declaration:

    <!ELEMENT SELECT - - (OPTGROUP|OPTION)+ -- option selector -->

    It declares the `select' element (in the Document Type Definition)
    so that you can use it in your markup later.

    Thomas 'PointedEars' Lahn, Feb 17, 2006
  5. dpodkuik

    Randy Webb Guest

    Thomas 'PointedEars' Lahn said the following on 2/17/2006 3:56 PM:
    To the OP: Ignore Thomas. He thinks he knows more than anybody else but
    he seldom does.
    Randy Webb, Feb 18, 2006
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.