Solved

Create instance of ASP JS function in ASP VBS

Posted on 2004-09-02
2
201 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
[X]
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
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Html Table looping 4 32
Clear input text 15 27
PHP encrypted string and passing to a ASP Page 12 49
Session on Html 8 42
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…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

726 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