[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A way to store functions?

On Mar 9, 12:43am, Konrad Kim wrote:
> Subject: A way to store functions?
> Is it possible to store functions at the parent frameset and have those
> functions accessible from other child nested framesets? What is the syntax
> for this as the JS netscape docs don't reveal this.

Sure - store the functions of methods of a top level object as follows:

function whatever() {
	alert("Your mamma's so fat . . .");

function initFunctions() {
	top.whatever = whatever;


You should then be able to call the stored function with top.whatever().

CAVEAT - I was using this method when I first started my project, storing all
functions as methods of the frames they were supposed to operate on.  I soon
abandoned it, though, since the stored methods were very unstable . . . window
resizes, etc. would wipe out my methods and cause tons of "showResults:
function not defined" error messages.  Not really something I wanted my users

Things seem much more stable when I define all my functions within the frames
they are called in.  Haven't inadvertantly lost one that way yet . . .


  d a t a b a s e s    a r e   i n   o u r  g e n e s
  Brian Karlak   bkarlak@panbio.com  (510) 337-7910 ph
  Manager, SciApps Group             (510) 522-9394 fx
  P  A  N  G  E  A     S  Y  S  T  E  M  S     I  N  C
For help about the list, please send a message to 'majordomo@obscure.org'
with the message body 'help'. To unsubscribe, send a message to
'majordomo@obscure.org' with the message body 'unsubscribe javascript'.
List archives and pointer to FAQ: http://www.obscure.org/javascript/