Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Create instance of ASP JS function in ASP VBS

Posted on 2004-09-02
2
199 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

766 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