banging my head against a wall with this one

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andy Fish

    banging my head against a wall with this one

    Hi,

    when I try to load this page on netscape or mozilla (latest versions), I get
    the error

    Error: document.form1. radiogroup[0] has no properties.

    It works fine on Opera or IE.

    I'm sure it is something to do with the definition of the <input> tags
    because if I move the type=radio to the beginning it works all right. I'm
    not sure whether it's a bug in the browser or a misunderstandin g on my part
    which the other browsers are working around.

    If this is a bug in mozilla, does anybody know any other workaround except
    changing the order of the attributes. Unfortunately, I'm generating this
    HTML with XSL and don't have control over the order the attributes get
    generated.

    <html>
    <BODY onload="alert( document.form1. radiogroup[0].value);">
    <FORM name="form1" id="form1" >
    <input id="radiogroup " value="one" name="radiogrou p" type="radio"> one
    <input id="radiogroup " value="two" name="radiogrou p" type="radio" > two
    </FORM>
    </BODY>
    </html>


  • Lasse Reichstein Nielsen

    #2
    Re: banging my head against a wall with this one

    "Andy Fish" <ajfish@blueyon der.co.uk> writes:
    [color=blue]
    > I must admit I have been a bit perplexed by this whole name and id thing for
    > controls - why you need both and what they're for.[/color]

    The short version is:

    For HTML, form elements only need name attributes. If you add id
    attributes, make them different from the name attributes and globally
    unique. Only the name attribute is used when you submit the form.

    For XHTML, only certain elements accepts the name attribute, but that
    includes form elements.

    /L 'please don't top post'
    --
    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...