?
Solved

Refering to a form in another Frame

Posted on 1997-03-12
1
Medium Priority
?
241 Views
Last Modified: 2008-03-17
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
Comment
Question by:stinnux
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
cherold earned 200 total points
ID: 1264991
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question