similar: Inserting objects into global scope in classic ASP / Javascript
Trying to get started with using javascript in classic ASP. Seem to be some "gotchas" with this though: can anyone with some experience in this tell me what's up with the "Blah2" code ? Seems like it "should" work but there seems to be a problem with my use of "this"...
<script language="javascript" runat="server">
var Blah = {};
Blah.w = function(s){Response.write(s);}
Blah.w('hello'); //this works...
var Blah2 = function(){
this.w = function(s){Response.write(s);}
//line above gives 'Object doesn't support this property or method'
return this;
}();
Blah2.w('hello');
</script>
Thanks for any pointers
Tim