Solved

Refering to a form in another Frame

Posted on 1997-03-12
1
228 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
1 Comment
 

Accepted Solution

by:
cherold earned 100 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
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…

705 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now