• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

Refering to a form in another Frame

I have to Frames (A and B). Frame A contains a form. Now, i want to Change the Value of a field that is in this form from frame B.

Is this possible?

I thought it should be something like this:

document.frames[0].form[0].fieldname.value="BlaBla";

But it does not work.
0
stinnux
Asked:
stinnux
1 Solution
 
cheroldCommented:
To refer to a different frame, first you need to reference the top frame, like top.frames[0].document.forms[0].fieldname.value

Observe:
main.html:
<HTML><HEAD><TITLE>main</TITLE></HEAD>
<FRAMESET ROWS="50%,*">
<FRAME NAME="one" SRC="one.html">
<FRAME NAME="two" SRC="two.html">
</FRAMESET>
</HTML>

one.html:
<HTML>
<HEAD><TITLE>one</TITLE></HEAD>
<BODY>
<FORM ACTION="" METHOD=GET>
<INPUT TYPE="text" NAME="test" VALUE="test">
<A HREF="#" onClick="document.forms[0].test.value='changed from one'">click</A>
</FORM>
</BODY>
</HTML>

two.html
<HTML><HEAD><TITLE>two</TITLE></HEAD>
<BODY>
<A HREF="#" onClick="top.frames[0].document.forms[0].test.value='changed value'">click here</A>
</BODY>
</HTML>
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now