Solved

Refering to a form in another Frame

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
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…

809 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