Subj : How to use scripts to create persistent objects? To : netscape.public.mozilla.jseng From : wayne Date : Mon Sep 13 2004 08:41 am According to the JavaScript C Engine Embedder's Guide: "NOTE: You can also use scripts to create persistent objects, too." However, I am unable to figure out how to accomplish this (and was unable to find previous newsgroup postings explaining this process after doing a *very* extensive search). JS_EvaluateScript() on the following JS: var m = new MyObject( 5 ); function MyObject( num ) { this.num = num; } alert( 'm.num = ' + m.num ); document.write( '
' ); var o = document.all[ "m1" ]; o.m = m; alert( 'o.m.num = ' + o.m.num ); var p = document.all[ "m1" ]; alert( 'p.m.num = ' + p.m.num ); Each alert( X.m.num ) prints "5" as expected. Then, we immediately do another JS_EvaluateScript() (same JSContext & Runtime) on the following JS: var q = document.all[ "m1" ]; alert( 'q.m.num = ' + q.m.num ); but instead of printing "5", we get "TypeError: q.m has no properties line 0". It may not be possible to answer without knowing all the C code behind this, but why does the technique of setting a property in the object held in the document.all array at "m1" appear to work within one script execution, but not subsequent script executions using essentially the same code? (By the way, replacing the second JS code segment with "alert( 'm.num = ' + m.num );" does output "5".) Any help and guidance would be most appreciated. Thank you, Wayne .