469,339 Members | 8,437 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,339 developers. It's quick & easy.

Object Does not support this property or Method error

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.







Jul 19 '05 #1
7 4893
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" <ra********@atc-nec.com> wrote in message
news:Ok**************@TK2MSFTNGP12.phx.gbl...
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.







Jul 19 '05 #2
Looks like you are mixing Javascript with VBScript IMHO.

Stuart
"Roberta McGervey" <ra********@atc-nec.com> wrote in message
news:Ok**************@TK2MSFTNGP12.phx.gbl...
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.







Jul 19 '05 #3
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" <st****@nowhere.co.uk> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
Looks like you are mixing Javascript with VBScript IMHO.

Stuart
"Roberta McGervey" <ra********@atc-nec.com> wrote in message
news:Ok**************@TK2MSFTNGP12.phx.gbl...
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.








Jul 19 '05 #4
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:ue**************@TK2MSFTNGP12.phx.gbl...
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" <ra********@atc-nec.com> wrote in message
news:Ok**************@TK2MSFTNGP12.phx.gbl...
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.








Jul 19 '05 #5
that is CLIENTSIDE code though, not SERVER

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Roberta McGervey" <ra********@atc-nec.com> wrote in message
news:eD**************@TK2MSFTNGP09.phx.gbl...
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" <st****@nowhere.co.uk> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
Looks like you are mixing Javascript with VBScript IMHO.

Stuart
"Roberta McGervey" <ra********@atc-nec.com> wrote in message
news:Ok**************@TK2MSFTNGP12.phx.gbl...
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.









Jul 19 '05 #6
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.
Jul 19 '05 #7
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.
Jul 19 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Purva khokhar | last post: by
1 post views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.