Hi All,

i have this.asp page:

<script type="text/vbscript">
Function Body_Onload()
' create the object
Set obj = Server.CreateObject("UploadImage.cTest")
' use method of the object
Body_Onload = obj.cTestDelete
Set obj = Nothing
End Function
</script>

<html>
<body onload="Body_Onload()">
</body>
</html>

the this.asp gives an Error while running:
Line 4
Char 1
Error Object required 'Server'
Code 0
URL http://127.0.0.1/this/this.asp

my Question:
How to create a Server Object in a Function?

Re: How to create a Server Object in a Function? by Mike

Mike
Sat Nov 04 14:47:47 CST 2006


"thisis" <helloOne@web.de> wrote in message
news:1162671288.445833.214670@m73g2000cwd.googlegroups.com...
> Hi All,
>
> i have this.asp page:
>
> <script type="text/vbscript">
> Function Body_Onload()
> ' create the object
> Set obj = Server.CreateObject("UploadImage.cTest")
> ' use method of the object
> Body_Onload = obj.cTestDelete
> Set obj = Nothing
> End Function
> </script>
>
> <html>
> <body onload="Body_Onload()">
> </body>
> </html>
>
> the this.asp gives an Error while running:
> Line 4
> Char 1
> Error Object required 'Server'
> Code 0
> URL http://127.0.0.1/this/this.asp
>
> my Question:
> How to create a Server Object in a Function?
>

You can't call server-side code directly from client-side code. You'll need
to send an asynchronous http request from the browser to a server-side
script which can then make calls to Server.CreateObject. Some people call
it Ajax. Have a look here: http://www.w3schools.com/ajax/

--
Mike Brind



Re: How to create a Server Object in a Function? by Anthony

Anthony
Sun Nov 05 06:53:18 CST 2006


"Mike Brind" <paxtonend@hotmail.com> wrote in message
news:Oc$g9JFAHHA.5060@TK2MSFTNGP02.phx.gbl...
>
> "thisis" <helloOne@web.de> wrote in message
> news:1162671288.445833.214670@m73g2000cwd.googlegroups.com...
> > Hi All,
> >
> > i have this.asp page:
> >
> > <script type="text/vbscript">
> > Function Body_Onload()
> > ' create the object
> > Set obj = Server.CreateObject("UploadImage.cTest")
> > ' use method of the object
> > Body_Onload = obj.cTestDelete
> > Set obj = Nothing
> > End Function
> > </script>
> >
> > <html>
> > <body onload="Body_Onload()">
> > </body>
> > </html>
> >
> > the this.asp gives an Error while running:
> > Line 4
> > Char 1
> > Error Object required 'Server'
> > Code 0
> > URL http://127.0.0.1/this/this.asp
> >
> > my Question:
> > How to create a Server Object in a Function?
> >
>
> You can't call server-side code directly from client-side code. You'll
need
> to send an asynchronous http request from the browser to a server-side
> script which can then make calls to Server.CreateObject. Some people call
> it Ajax. Have a look here: http://www.w3schools.com/ajax/

Why does it need to asynchronous? I many cases this is undesirable.




Re: How to create a Server Object in a Function? by Mike

Mike
Sun Nov 05 13:46:41 CST 2006


"Anthony Jones" <Ant@yadayadayada.com> wrote in message
news:eky4elNAHHA.3928@TK2MSFTNGP03.phx.gbl...
>
> "Mike Brind" <paxtonend@hotmail.com> wrote in message
> news:Oc$g9JFAHHA.5060@TK2MSFTNGP02.phx.gbl...
>>
>> "thisis" <helloOne@web.de> wrote in message
>> news:1162671288.445833.214670@m73g2000cwd.googlegroups.com...
>> > Hi All,
>> >
>> > i have this.asp page:
>> >
>> > <script type="text/vbscript">
>> > Function Body_Onload()
>> > ' create the object
>> > Set obj = Server.CreateObject("UploadImage.cTest")
>> > ' use method of the object
>> > Body_Onload = obj.cTestDelete
>> > Set obj = Nothing
>> > End Function
>> > </script>
>> >
>> > <html>
>> > <body onload="Body_Onload()">
>> > </body>
>> > </html>
>> >
>> > the this.asp gives an Error while running:
>> > Line 4
>> > Char 1
>> > Error Object required 'Server'
>> > Code 0
>> > URL http://127.0.0.1/this/this.asp
>> >
>> > my Question:
>> > How to create a Server Object in a Function?
>> >
>>
>> You can't call server-side code directly from client-side code. You'll
> need
>> to send an asynchronous http request from the browser to a server-side
>> script which can then make calls to Server.CreateObject. Some people
>> call
>> it Ajax. Have a look here: http://www.w3schools.com/ajax/
>
> Why does it need to asynchronous? I many cases this is undesirable.
>

How do you mean?



Re: How to create a Server Object in a Function? by thisis

thisis
Sun Nov 05 23:47:07 CST 2006


Mike Brind wrote:
> "Anthony Jones" <Ant@yadayadayada.com> wrote in message
> news:eky4elNAHHA.3928@TK2MSFTNGP03.phx.gbl...
> >
> > "Mike Brind" <paxtonend@hotmail.com> wrote in message
> > news:Oc$g9JFAHHA.5060@TK2MSFTNGP02.phx.gbl...
> >>
> >> "thisis" <helloOne@web.de> wrote in message
> >> news:1162671288.445833.214670@m73g2000cwd.googlegroups.com...
> >> > Hi All,
> >> >
> >> > i have this.asp page:
> >> >
> >> > <script type="text/vbscript">
> >> > Function Body_Onload()
> >> > ' create the object
> >> > Set obj = Server.CreateObject("UploadImage.cTest")
> >> > ' use method of the object
> >> > Body_Onload = obj.cTestDelete
> >> > Set obj = Nothing
> >> > End Function
> >> > </script>
> >> >
> >> > <html>
> >> > <body onload="Body_Onload()">
> >> > </body>
> >> > </html>
> >> >
> >> > the this.asp gives an Error while running:
> >> > Line 4
> >> > Char 1
> >> > Error Object required 'Server'
> >> > Code 0
> >> > URL http://127.0.0.1/this/this.asp
> >> >
> >> > my Question:
> >> > How to create a Server Object in a Function?
> >> >
> >>
> >> You can't call server-side code directly from client-side code. You'll
> > need
> >> to send an asynchronous http request from the browser to a server-side
> >> script which can then make calls to Server.CreateObject. Some people
> >> call
> >> it Ajax. Have a look here: http://www.w3schools.com/ajax/
> >
> > Why does it need to asynchronous? I many cases this is undesirable.
> >
>
> How do you mean?

Hi Mike Brind,

I looked at the link you gave, thanks.

I don't understand what's ajax got to do with my question in the start
of this thread:

How to create a Server Object in a Function using VBScript?


Re: How to create a Server Object in a Function? by Jon

Jon
Mon Nov 06 00:09:15 CST 2006

you are writing client side code you need to write asp server side code.

http://msconline.maconstate.edu/tutorials/default.aspx



"thisis" <helloOne@web.de> wrote in message news:1162671288.445833.214670@m73g2000cwd.googlegroups.com...
> Hi All,
>
> i have this.asp page:
>
> <script type="text/vbscript">
> Function Body_Onload()
> ' create the object
> Set obj = Server.CreateObject("UploadImage.cTest")
> ' use method of the object
> Body_Onload = obj.cTestDelete
> Set obj = Nothing
> End Function
> </script>
>
> <html>
> <body onload="Body_Onload()">
> </body>
> </html>
>
> the this.asp gives an Error while running:
> Line 4
> Char 1
> Error Object required 'Server'
> Code 0
> URL http://127.0.0.1/this/this.asp
>
> my Question:
> How to create a Server Object in a Function?
>



Re: How to create a Server Object in a Function? by Mike

Mike
Mon Nov 06 02:13:18 CST 2006

"thisis" <helloOne@web.de> wrote in message
news:1162792027.588692.255630@b28g2000cwb.googlegroups.com...
>
> Mike Brind wrote:
>> "Anthony Jones" <Ant@yadayadayada.com> wrote in message
>> news:eky4elNAHHA.3928@TK2MSFTNGP03.phx.gbl...
>> >
>> > "Mike Brind" <paxtonend@hotmail.com> wrote in message
>> > news:Oc$g9JFAHHA.5060@TK2MSFTNGP02.phx.gbl...
>> >>
>> >> "thisis" <helloOne@web.de> wrote in message
>> >> news:1162671288.445833.214670@m73g2000cwd.googlegroups.com...
>> >> > Hi All,
>> >> >
>> >> > i have this.asp page:
>> >> >
>> >> > <script type="text/vbscript">