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

Re: Frames and forms help.




On Thu, 1 Feb 1996, Steven J. Weinberger wrote:

> 
>         I am writing a page with JS and frames, and I have a question about
> accessing forms from different frames.  Each frame conatains documents with
> some of their own JS <script> and a form.  I am trying to get an onClick()
> on one form to copy a value from another form in another frame. like putting
> in one script:
>                         onClick="parent.total.myform.textbox.value='5'";
> 
> where total is a named frame, myform is a named form in it, and textbox is
> in that form.  This line is on a form in another named frame. What I always
> get back is a "myform has no properties" error. Is there a way to get into
> one form's fields from another form/file/script? Or will i have to make
> variables to hold the data, and then trigger a function on the other page to
> read it in?
> 
>                                         Any help appreciated,
>                                         Steven Weinberger
> 
> 

Steven,

Let's assume the value being entered is in a variable called x in form y 
in frame z and you want it to appear in a text area a in form b in frame 
c, I would try (and I'm only guessing here, I haven't actually tried it) 
this:

onclick="window.parent.frames['c'].forms['b'].a.value = 
window.parent.frames['z'].forms['y'].x.value"

I know some of the syntax is off, but I'm doing this off of the top of my 
head without referring back to any of my documentation (which I don't 
have at work at the moment.)

Let me know if it works. Good luck.

Regards,
SETH