Object Does not support this property or Method error

Discussion in 'ASP General' started by Roberta McGervey, Jan 26, 2004.

  1. I have the following code:

    <Script LANGUAGE=vbscript RUNAT=Server>

    for i =0 to document.form1.elements.count-1

    response.write "test"

    next

    </Script>

    When it gets to the line for i=0.... the error message pops up stating that
    Object does not support this Property or Method.



    I have a from name form1.



    Please help.
     
    Roberta McGervey, Jan 26, 2004
    #1
    1. Advertising

  2. Roberta McGervey

    Curt_C [MVP] Guest

    it's because the server doesn't know what
    document.form1.elements.count
    is, that's my bet.

    --
    Curt Christianson
    Owner/Lead Developer, DF-Software
    www.Darkfalz.com


    "Roberta McGervey" <> wrote in message
    news:...
    > I have the following code:
    >
    > <Script LANGUAGE=vbscript RUNAT=Server>
    >
    > for i =0 to document.form1.elements.count-1
    >
    > response.write "test"
    >
    > next
    >
    > </Script>
    >
    > When it gets to the line for i=0.... the error message pops up stating

    that
    > Object does not support this Property or Method.
    >
    >
    >
    > I have a from name form1.
    >
    >
    >
    > Please help.
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
     
    Curt_C [MVP], Jan 26, 2004
    #2
    1. Advertising

  3. Roberta McGervey

    Stuart Guest

    Looks like you are mixing Javascript with VBScript IMHO.

    Stuart


    "Roberta McGervey" <> wrote in message
    news:...
    > I have the following code:
    >
    > <Script LANGUAGE=vbscript RUNAT=Server>
    >
    > for i =0 to document.form1.elements.count-1
    >
    > response.write "test"
    >
    > next
    >
    > </Script>
    >
    > When it gets to the line for i=0.... the error message pops up stating

    that
    > Object does not support this Property or Method.
    >
    >
    >
    > I have a from name form1.
    >
    >
    >
    > Please help.
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
     
    Stuart, Jan 27, 2004
    #3
  4. I got the following code from MSDN to use as an example. So if I am mixing
    to two languages it is because the MSDN is incorrect.

    <SCRIPT LANGUAGE="VBScript">
    <!-
    Sub cmdChange_OnClick
    For i=0 To Document.frmForm.Elements.Count-1
    Document.frmForm.Elements(i).Value="Changed!"
    Next
    End Sub
    ->
    </SCRIPT>


    "Stuart" <> wrote in message
    news:%23R1l%...
    > Looks like you are mixing Javascript with VBScript IMHO.
    >
    > Stuart
    >
    >
    > "Roberta McGervey" <> wrote in message
    > news:...
    > > I have the following code:
    > >
    > > <Script LANGUAGE=vbscript RUNAT=Server>
    > >
    > > for i =0 to document.form1.elements.count-1
    > >
    > > response.write "test"
    > >
    > > next
    > >
    > > </Script>
    > >
    > > When it gets to the line for i=0.... the error message pops up stating

    > that
    > > Object does not support this Property or Method.
    > >
    > >
    > >
    > > I have a from name form1.
    > >
    > >
    > >
    > > Please help.
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >

    >
    >
     
    Roberta McGervey, Jan 27, 2004
    #4
  5. I'm new to this so is there a setting on the web server I can change so that
    it recognizes this statement?

    I found a different way to do what I want to do but it would require more
    code. From the interdev and vbscript courses I took online this statment
    should work.

    Thanks.
    "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    news:...
    > it's because the server doesn't know what
    > document.form1.elements.count
    > is, that's my bet.
    >
    > --
    > Curt Christianson
    > Owner/Lead Developer, DF-Software
    > www.Darkfalz.com
    >
    >
    > "Roberta McGervey" <> wrote in message
    > news:...
    > > I have the following code:
    > >
    > > <Script LANGUAGE=vbscript RUNAT=Server>
    > >
    > > for i =0 to document.form1.elements.count-1
    > >
    > > response.write "test"
    > >
    > > next
    > >
    > > </Script>
    > >
    > > When it gets to the line for i=0.... the error message pops up stating

    > that
    > > Object does not support this Property or Method.
    > >
    > >
    > >
    > > I have a from name form1.
    > >
    > >
    > >
    > > Please help.
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > >

    >
    >
     
    Roberta McGervey, Jan 27, 2004
    #5
  6. Roberta McGervey

    Curt_C [MVP] Guest

    that is CLIENTSIDE code though, not SERVER

    --
    Curt Christianson
    Owner/Lead Developer, DF-Software
    www.Darkfalz.com


    "Roberta McGervey" <> wrote in message
    news:...
    > I got the following code from MSDN to use as an example. So if I am

    mixing
    > to two languages it is because the MSDN is incorrect.
    >
    > <SCRIPT LANGUAGE="VBScript">
    > <!-
    > Sub cmdChange_OnClick
    > For i=0 To Document.frmForm.Elements.Count-1
    > Document.frmForm.Elements(i).Value="Changed!"
    > Next
    > End Sub
    > ->
    > </SCRIPT>
    >
    >
    > "Stuart" <> wrote in message
    > news:%23R1l%...
    > > Looks like you are mixing Javascript with VBScript IMHO.
    > >
    > > Stuart
    > >
    > >
    > > "Roberta McGervey" <> wrote in message
    > > news:...
    > > > I have the following code:
    > > >
    > > > <Script LANGUAGE=vbscript RUNAT=Server>
    > > >
    > > > for i =0 to document.form1.elements.count-1
    > > >
    > > > response.write "test"
    > > >
    > > > next
    > > >
    > > > </Script>
    > > >
    > > > When it gets to the line for i=0.... the error message pops up stating

    > > that
    > > > Object does not support this Property or Method.
    > > >
    > > >
    > > >
    > > > I have a from name form1.
    > > >
    > > >
    > > >
    > > > Please help.
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Curt_C [MVP], Jan 27, 2004
    #6
  7. Roberta McGervey

    Bob Barrows Guest

    Roberta McGervey wrote:
    > I'm new to this so is there a setting on the web server I can change
    > so that it recognizes this statement?


    No. "document" is a client-side DHTML object. Server-side code knows nothing
    about client-side DHTML.

    >
    > I found a different way to do what I want to do but it would require
    > more code. From the interdev and vbscript courses I took online this
    > statment should work.


    Then you need to reread those sources. You can never reference a client-side
    object or property from server-side code, and vice versa.
    Your code would work fine if you removed the "RUNAT=Server" piece from the
    script tag.

    Bob Barrows
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows, Jan 27, 2004
    #7
  8. Roberta McGervey

    Bob Barrows Guest

    Roberta McGervey wrote:
    > I got the following code from MSDN to use as an example. So if I am
    > mixing to two languages it is because the MSDN is incorrect.


    No, it's because your code is incorrect.

    MSDN's code:
    >
    > <SCRIPT LANGUAGE="VBScript">


    Your code:
    >> <Script LANGUAGE=vbscript RUNAT=Server>


    See the difference?

    Actually, Stuart was incorrect: you are not mixing two languages. Your
    mistake is attempting to use a server-side script block (RUNAT=Server) to
    run code that can only run on the client.

    This is the main obstacle to people attempting to learn to use asp (myself
    included): learning the difference between server-side code and client-side
    code. There are many asp tutorial sites out there (www.asp101.com, etc.)
    that do a reasonable job of explaining the differennce better than i can do
    in an email message.

    Bob Barrows
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows, Jan 27, 2004
    #8
    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. Roman
    Replies:
    0
    Views:
    4,066
    Roman
    Jan 4, 2004
  2. Rohan Hattangdi

    Object does not support this property or method.

    Rohan Hattangdi, Aug 24, 2004, in forum: ASP General
    Replies:
    10
    Views:
    246
    Ray Costanzo [MVP]
    Aug 24, 2004
  3. mygoogleac
    Replies:
    0
    Views:
    197
    mygoogleac
    Oct 2, 2003
  4. Matt
    Replies:
    3
    Views:
    234
  5. Replies:
    7
    Views:
    133
    Ian Collins
    Apr 27, 2006
Loading...

Share This Page