You are here: irt.org | FAQ | JavaScript | Object | Q1306 [ previous next ]
If you need to hold lots of references all at once, and don't want a subsequent reference to be overwritten by another then try something like:
<script language="JavaScript"><!--
// define the myString object
function myString(value) {
this.value = value;
var now = (new Date()).getTime();
eval('tmp' + now + ' = this');
setTimeout('alert(tmp' + now + '.value)',1000);
}
// create an instance of a myString object
var mytext1 = new myString('this is a test');
var mytext2 = new myString('this is another test');
//--></script>