Solved

Create instance of ASP JS function in ASP VBS

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

831 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