Object error in function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steve Bishop

    Object error in function

    I keep getting "Object does not support property or method". Help
    appreciated. Thanks.
    <html>
    <head>
    <SCRIPT LANGUAGE="JavaS cript">
    function showtable(){
    var myform1 = document.form1
    if(myform1.T1.v alue=="Size Mix")
    {
    document.getEle mentByid "Table1").style .visibility="hi dden"
    }
    }

    </script>

    </head>

    <body onLoad= "showtable( )">
    <form name="form1"><i nput type="text" name="T1" value="Size Mix">
    <table border="1" id="Table1" width="100%">



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
  • Michael Winter

    #2
    Re: Object error in function

    On 09 Feb 2004 19:09:32 GMT, Steve Bishop <steveb@viper.c om> wrote:
    [color=blue]
    > I keep getting "Object does not support property or method". Help
    > appreciated. Thanks.
    > <html>
    > <head>
    > <SCRIPT LANGUAGE="JavaS cript">[/color]

    The 'type' attribute is required (and sufficient); 'language' is not. This
    should read

    <script type="text/javascript">
    [color=blue]
    > function showtable(){
    > var myform1 = document.form1[/color]

    End statements with a semi-colon (;).
    [color=blue]
    > if(myform1.T1.v alue=="Size Mix")
    > {
    > document.getEle mentByid "Table1").style .visibility="hi dden"[/color]

    If this is a direct copy, your problem is two-fold:

    1) The method name is "getElementById ". Remember that case is significant
    in JavaScript.
    2) You missed the opening parenthesis in the method call.

    The missing semi-colon appies here, too.

    [snip]

    Mike

    --
    Michael Winter
    M.Winter@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)

    Comment

    • Richard Cornford

      #3
      Re: Object error in function

      "Steve Bishop" <steveb@viper.c om> wrote in message
      news:4027daec$0 $202$75868355@n ews.frii.net...[color=blue]
      > I keep getting "Object does not support property or method".[/color]
      <snip>[color=blue]
      >document.getEl ementByid "Table1").style .visibility="hi dden"[/color]
      ^
      I
      Case sensitivity, it should be an upper case I in getElementById.

      Richard.


      Comment

      Working...