[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: variable assignment from child window
John Ray wrote:
> I need to find out if something I'm doinging is considered an
Based on my understanding of the problem, it's an acceptable coding
practice that (absent a workaround) can unfortunately run afoul of bugs
in the implementation.
> I've set up user registration for my home page that takes input on a
> form in a child window called stat_window. Before opening the window I
> create a property of stat_window called nav for accessing the main
> Navigator window functions and properties with:
> So far so good. The problem is this: From the child window I call
> a function in the nav window that needs to access the data that was
> just entered in the child window form. I don't want to change the
> function to accept arguments and pass the values unless absolutely
> necessary. What I have done is changed the values of two global
> variables (user_name and e_mail) in the Navigator window, from the
> child window with the following.
> nav.user_name=<value from the form field>
> nav.e_mail=<value from the form field>[omitted]
> Is it legitimate to directly assign a value to a variable in a
> different window/file in this manner?
Yes; as far as I'm aware we don't deprecate this practice as inherently
> And if it is, is there a trick to making
> it reliable.
Try forcing a copy of the variables instead of direct assignment; e.g.,
nav.user_name= "" + <value from the form field>
The bugs I've seen and heard of have to do with the original object in
the child window (or frame) going away (e.g., due to a reload) and the
parent window or frame being left with a pointer to nowhere. Forcing a
copy ensures that the parent window has valid values no matter what
happens to the child window.
Frank Hecker Pre-sales tech support, Netscape Federal sales
For help about the list, please send a message to 'email@example.com'
with the message body 'help'. To unsubscribe, send a message to