ASP - create in just script instance of class provided in current page with different language 
Author Message
 ASP - create in just script instance of class provided in current page with different language

Maybe difficult to understand what I mean...
I have a ASP page with contain to parts of code with different languages -
one part on VBScript and one on JScript.
In first part (VBScript) i create class with few methods. In second part
(JScript) I try to create instance of class (create object) and use it. But
I receive a error (runtime say me "object underfined" - he can't find the
class to create object). So, what's wrong here? The simple example is below.
Thanks you!!

<SCRIPT RUNAT=SERVER Language=VBScript>
  class Description
  public Function Method1()
   Method1 = Now
  End Function
 End class
</SCRIPT>

<SCRIPT RUNAT=SERVER Language=javascript>
 public_description = new Description();
</SCRIPT>

--

Sincerely German
================
"I think there is a world market for maybe five computers." --Thomas
Watson, Chairman of IBM, 1943



Tue, 15 Jun 2004 17:35:25 GMT  
 ASP - create in just script instance of class provided in current page with different language
http://www.aspfaq.com/show.asp?id=2045

Order matters

-Deepa


Quote:
> Maybe difficult to understand what I mean...
> I have a ASP page with contain to parts of code with different languages -
> one part on VBScript and one on JScript.
> In first part (VBScript) i create class with few methods. In second part
> (JScript) I try to create instance of class (create object) and use it.
But
> I receive a error (runtime say me "object underfined" - he can't find the
> class to create object). So, what's wrong here? The simple example is
below.
> Thanks you!!

> <SCRIPT RUNAT=SERVER Language=VBScript>
>   class Description
>   public Function Method1()
>    Method1 = Now
>   End Function
>  End class
> </SCRIPT>

> <SCRIPT RUNAT=SERVER Language=javascript>
>  public_description = new Description();
> </SCRIPT>

> --

> Sincerely German
> ================
> "I think there is a world market for maybe five computers." --Thomas
> Watson, Chairman of IBM, 1943



Tue, 15 Jun 2004 20:55:01 GMT  
 ASP - create in just script instance of class provided in current page with different language
Besides the issue of order in ASP pages, you can't create VBScript class instances directly from
JScript code (or vice versa).  You need to provide a VBScript accessor function that creates and
returns an instance.

Here's a simple WSH hosted .wsf example...

<job>
<SCRIPT Language=VBScript>
  class Description
  public Function Method1()
   Method1 = Now
  End Function
 End class
 function newDescription()
   set newDescription = new Description
 end function
</SCRIPT>

<SCRIPT Language=javascript>
 public_description = newDescription();
 WScript.echo(public_description.Method1());
</SCRIPT>
</job>

--
Michael Harris
Microsoft.MVP.Scripting
--

Quote:

> http://www.aspfaq.com/show.asp?id=2045

> Order matters

> -Deepa



> > Maybe difficult to understand what I mean...
> > I have a ASP page with contain to parts of code with different languages -
> > one part on VBScript and one on JScript.
> > In first part (VBScript) i create class with few methods. In second part
> > (JScript) I try to create instance of class (create object) and use it.
> But
> > I receive a error (runtime say me "object underfined" - he can't find the
> > class to create object). So, what's wrong here? The simple example is
> below.
> > Thanks you!!

> > <SCRIPT RUNAT=SERVER Language=VBScript>
> >   class Description
> >   public Function Method1()
> >    Method1 = Now
> >   End Function
> >  End class
> > </SCRIPT>

> > <SCRIPT RUNAT=SERVER Language=javascript>
> >  public_description = new Description();
> > </SCRIPT>

> > --

> > Sincerely German
> > ================
> > "I think there is a world market for maybe five computers." --Thomas
> > Watson, Chairman of IBM, 1943



Wed, 16 Jun 2004 03:07:22 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. ASP - create in just script instance of class provided in current page with different language

2. ASP page VB Script creating a new collection?

3. Can I create programetically add a page and field to the current form in calendaer item

4. Minitoring Current URL in another IE Instance

5. Navigate to folder in current Windows Explorer instance

6. Connecting to current instance of browser

7. Sending current HTML/ASP page as mail

8. How to get path of current ASP-Page?

9. GET THE URL OF THE CURRENT PAGE IN ASP

10. ASP/Vbscript: saving the current page..

11. How to get path of current ASP-Page?

12. How to get name of the current page in ASP

 

 
Powered by phpBB® Forum Software