Vbscript class in jscript page (ASP) 
Author Message
 Vbscript class in jscript page (ASP)

I'm trying to use a VBScript class from a jscript page but i receive:

Microsoft JScript runtime (0x800A01FB)
An exception occurred
/editores/upload/vb_in_js.asp, line 55

line 55 is:

Response.Write("data: " + mydata.getdata());

below the whole code:


<SCRIPT language=VBScript runat=Server>
Class dataParser
 Private data
 Private delimiter
 Private currentPos

 Public Sub Completar(newdata, newdelimiter)
  data = newdata
  delimiter = newdelimiter
 End Sub

 Public Property Get getdata()
  getdata = data
 End Property

 Public Property Get getdelimiter()
  getdelimiter = delimiter
 End Property

 Public Property Get getcurrentPos()
  getcurrentPos = currentPos
 End Property

 Private Sub Class_Terminate()

  data = ""
  delimiter = ""
  currentPos = 0

 End Sub

 Private Sub Class_Initialize()

  data = "aaa"
  delimiter = "yyy"
  currentPos = 1

 End Sub

End Class

Function NewdataParser
 Set NewdataParser = New dataParser
 'NewdataParser = New dataParser
End Function

</SCRIPT>
<%

var mydata = NewdataParser();

line 55 -> Response.Write("data: " + mydata.getdata());
//Response.Write("delimiter: " + mydata.delimiter);
//Response.Write("currentPos: " + mydata.currentPos);
%>

thanks!

chulai



Sun, 22 May 2005 06:46:06 GMT  
 Vbscript class in jscript page (ASP)
I have to add that i can do the opposite: call a jscript class in vbscript
page with an example that i found in other thread:

<SCRIPT language="JScript" RUNAT="Server">
function dataParser(data,delimiter) {
 this.data = data;
 this.delimiter = delimiter;
 this.currentPos = 0;
 return this;

Quote:
}

var myParser = new dataParser("x y z","aaaaa");

function pasar() {
 var myParser2 = new dataParser("x y z","iii");
 return myParser2
// return new dataParser("x y z","eeee");

Quote:
}

</SCRIPT>

<%
 set miparse = pasar()

 Response.Write miparse.data

 Response.Write miparse.delimiter

 Response.Write miparse.currentPos

  Response.Write "*******<BR>"
  Response.Write myParser.data & "<BR>" & vbCrLf
  Response.Write myParser.delimiter & "<BR>" & vbCrLf
  Response.Write myParser.currentPos & "<BR>" & vbCrLf
  Response.Write "*******<BR>"
%>


Quote:
> I'm trying to use a vbscript class from a jscript page but i receive:

> Microsoft JScript runtime (0x800A01FB)
> An exception occurred
> /editores/upload/vb_in_js.asp, line 55

> line 55 is:

> Response.Write("data: " + mydata.getdata());

> below the whole code:


> <SCRIPT language=VBScript runat=Server>
> Class dataParser
>  Private data
>  Private delimiter
>  Private currentPos

>  Public Sub Completar(newdata, newdelimiter)
>   data = newdata
>   delimiter = newdelimiter
>  End Sub

>  Public Property Get getdata()
>   getdata = data
>  End Property

>  Public Property Get getdelimiter()
>   getdelimiter = delimiter
>  End Property

>  Public Property Get getcurrentPos()
>   getcurrentPos = currentPos
>  End Property

>  Private Sub Class_Terminate()

>   data = ""
>   delimiter = ""
>   currentPos = 0

>  End Sub

>  Private Sub Class_Initialize()

>   data = "aaa"
>   delimiter = "yyy"
>   currentPos = 1

>  End Sub

> End Class

> Function NewdataParser
>  Set NewdataParser = New dataParser
>  'NewdataParser = New dataParser
> End Function

> </SCRIPT>
> <%

> var mydata = NewdataParser();

> line 55 -> Response.Write("data: " + mydata.getdata());
> //Response.Write("delimiter: " + mydata.delimiter);
> //Response.Write("currentPos: " + mydata.currentPos);
> %>

> thanks!

> chulai



Sun, 22 May 2005 06:52:05 GMT  
 Vbscript class in jscript page (ASP)
Asked and answered in...

microsoft.public.inetsdk.programming.scripting.jscript

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US



Sun, 22 May 2005 08:06:51 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Emergency - Thread or Cache problem with Paradox

2. Message Boxes

3. VBScript Class scope in ASP pages?

4. VBScript and JScript in same ASP page

5. How to pass an n-dim array from VBScript to JScript within an ASP page

6. VBScript and JScript in same ASP page

7. call a jscript-function in the vbscript-part of an asp-page

8. BMP Viewer

9. FOR loops and disk writing

10. ALTER TABLE/ALTER COLUMN problem with MS Access 2K

11. deleting an alias from BDE at runtime

12. Jscript equivelent of server side vbscript in ASP

 

 
Powered by phpBB® Forum Software