Subj : Re: Why JS_CompileScript Error? To : netscape.public.mozilla.jseng From : Peter Wilson Date : Fri Aug 26 2005 02:08 pm jijun.zhang@gmail.com wrote: > when i use js library compile a script, the follow error occur > > script100:1: SyntaxError: missing ( before formal parameters: > script100:1: function window.document() { window.document.abc = 1; } > script100:1: ...............^ > > can anybody help me? i think maybe i havn't define the class window in > context, but when i try to replace the "window.document" with > "math.sqrt", which object is defined as internal, the error is similar. > Because that isn't valid JavaScript syntax: Assuming you have an object called 'window' and you want to declare a function called 'document' as a propery of that object then you would use window.document = function() { } Although I'm not convinced that's what you want. Can I recommend David Flanagans excellent 'JavaScript - The Definitive Guide'? Pete -- http://www.whitebeam.org http://www.yellowhawk.co.uk ------- .