Is it a bug?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Gorodyansky

    Is it a bug?

    Hi,

    The following page's JavaScript does not work in Netscape 7.1/
    Mozilla 1.3+ (that is, an image does NOT appear if one chooses
    a keyboard layout):


    Is it a bug in Netscape/Mozilla JavaScript implementation?

    --
    Regards,
    Paul Gorodyansky
    "Cyrillic (Russian): instructions for Windows and Internet":

  • Lasse Reichstein Nielsen

    #2
    Re: Is it a bug?

    Paul Gorodyansky <paulgor@compus erve.com> writes:
    [color=blue]
    > The following page's JavaScript does not work in Netscape 7.1/
    > Mozilla 1.3+ (that is, an image does NOT appear if one chooses
    > a keyboard layout):
    > http://www.microsoft.com/globaldev/r...keyboards.aspx
    >
    > Is it a bug in Netscape/Mozilla JavaScript implementation?[/color]

    Why would you think it is a bug in the browser, and not in the javascript
    code itself? Which is more likely?

    It is a bug in the Javascript code. It is an accident if it works in
    any browser (IE is known to be very accident prone).

    More precisely, the error is in the line:
    onChange="choos eKeyboard(docum ent.choose.stat e.options[state.selectedI ndex].value)"

    Some browsers allow you to refer to named forms as properties of the
    document area. It is still not as safe an assumption as writing
    document.forms['choose']
    Some browsers also allow toy to refer to form elements as properties
    of the form. It is safer to use the "elementes" collection.

    Very few browsers allow you to access named form elements as properties
    of the global object. That is what the above line tries:
    state.selectedI ndex
    There is no global variable called "state". What should be writte is:

    onchange="var select=document .forms['choose'].elements['state'];
    chooseKeyboard( select.options[select.selected Index].value);"

    Then it will work in other browsers than IE.
    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    Working...