Problems with JScript 
Author Message
 Problems with JScript

Ok heres the deal I have serveral object constructors in a file I've called
objects.js an I want to create a new instance of one of those objects when
new session is started. Keep in mind Im doing this in JScript not vb or
javascript. Thus far I havent had much luck getting any useful advice so if
anyone can help me out or at least point me to some more complete
JScript/ASP references/resources it would me appreciated.

Stephen



Fri, 07 Feb 2003 03:00:00 GMT  
 Problems with JScript

If I understand your question, you want to inatantiate an object:

To instantiate an object use this syntax

Syntax
Server.CreateObject( progID )

Parameters
progID
Specifies the type of object to create. The format for progID is
[Vendor.]Component[.Version].

Example
<% Set MyAd = Server.CreateObject("MSWC.AdRotator") %>

Quote:

>Ok heres the deal I have serveral object constructors in a file I've called
>objects.js an I want to create a new instance of one of those objects when
>new session is started. Keep in mind Im doing this in JScript not vb or
>javascript. Thus far I havent had much luck getting any useful advice so if
>anyone can help me out or at least point me to some more complete
>JScript/ASP references/resources it would me appreciated.

>Stephen




Fri, 07 Feb 2003 03:00:00 GMT  
 Problems with JScript
Not sure if this is what you were asking for, but here goes. If you want to
create an instance of an object that you've defined, just create it using
"new" then use the object (don't know if this is the best way to do this,
but this is the way I do it)

If your constructor is defined as follows:

function sampleObject(property1Val, property2Val)
{
  this.someProperty1 = property1Val;
  this.someProperty2 = property2Val;
  this.someMethod = someMethodImplementedByObject;

Quote:
}

function someMethodImplementedByObject(parm1, parm2)
{
  return parm1 + parm2;

Quote:
}

then instantiate a new object like so:

var thing = new sampleObject("value1", "value2");

And, if you want to change/access the values for the object, just
assign/access them, like so:

thing.someProperty1 = "new property 1 value";
alert(thing.someProperty1);

and call the object's methods like so:

alert(thing.someMethod("hello ", "there"));

HTH!

Quote:

>Ok heres the deal I have serveral object constructors in a file I've called
>objects.js an I want to create a new instance of one of those objects when
>new session is started. Keep in mind Im doing this in JScript not vb or
>javascript. Thus far I havent had much luck getting any useful advice so if
>anyone can help me out or at least point me to some more complete
>JScript/ASP references/resources it would me appreciated.

>Stephen




Sun, 09 Feb 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Problem with jScript

2. Problem with JScript

3. ADO Recordset problems and JScript syntax questions....

4. Problem with JScript

5. Problem with Jscript enumerator and ADSI

6. Problem with JScript and large documents

7. Problem with Jscript and Recordset GetRows() method

8. Some problem in JScript:how to execute a special js statment

9. COM object methods OK in VB Script - Problems in JScript

10. Problems with JScript constructor property and WSC

11. Problem with JScript Date() on CE 2002

12. Dear Eric: problem with JScript <string>.split function

 

 
Powered by phpBB® Forum Software