Ah, see, I'm thinking of creating my own object like you can in JavaScript, here's the JS code:
HTML Code:
function run() {
var myObj = new Object();
myObj.name = "John";
myObj.age = 21;
myObj.add = function(x,y) { return x+y };
myObj.print = function() { document.getElementById("output").innerText = myObj.name + " is " + myObj.age + " years old"};
}
So if I call myObj.print(); it prints "John is 21 years old" and if I call myObj.add(5,3) I get 8... I didn't know if in ASP you could create your own objects on the fly.
I've never used Jscript inside ASP, does that mean I can write in JS and have the server render it instead of the client?
Edit: Wow, for some reason I though JScript ASP was something else... very interesting.
This works:
HTML Code:
<% @Language = JScript %>
<%
var myObj = new Object();
myObj.name = "John";
myObj.age = 21;
myObj.add = function(x,y) { return x+y };
myObj.print = function() { return myObj.name + " is " + myObj.age + " years old"};
Response.Write(myObj.print());
%>
But does VBScript support user-created objects?
Last edited by funkdaddu; 08-30-2005 at 12:46 PM..
|