Solved

Create instance of ASP JS function in ASP VBS

Posted on 2004-09-02
2
190 Views
Last Modified: 2008-02-20
okay, I have a server-side asp javascript "class":

function Graphic(){
  ...
}

I'm trying to figure out how to create a new instance of it in asp vbs.  I can create an instance in javascript easily enough: "var whatever = new Graphic();", but it's annoying to type:

%><script language="Javascript" runat="server">var whatever = new Graphic();</script><%

every time I want a new instance of the object.

thx
0
Comment
Question by:cwolves
2 Comments
 
LVL 4

Accepted Solution

by:
chipple earned 250 total points
ID: 11970440
You will have to create the instance in JScript and pass it back to VBScript.
You can make a JScript function for this purpose.
The reason it doesn't work directly is that VBScript doesn't understand JScript's classes.

<script language="Javascript" runat="server">

function Graphic() {
  this.hello = "hello!";
}

function CreateGraphicVB() {
  return new Graphic();
}

</script><%

Dim whatever
Set whatever = CreateGraphicVB()
Response.Write whatever.hello

%>

Good luck.
0
 
LVL 9

Author Comment

by:cwolves
ID: 11973466
thx  :-)
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now