Page 1 of 1

How to get data from another frame ?

PostPosted: Mon Aug 31, 2015 10:45 am
by David de Argentina
Hi all,

I'm doing a program in order to manipulate a mysql database.
As server does not allow remote connection with the database, i need do this program using php / javascript

Program has two frames: Top frame has the process buttons ( New, Delete, Modify, Refresh, etc) and Main frame has the data.

Figure 1:

Image

Main Frame table has a radio button controls, in order to determine what record i want to process.

Using this javascript i can get the real ID of the row of the table:

Code: Select all
for (var x = 0; x < 15; x++) { if (document.getElementsByName('cual')[x].checked) { alert('id = ' + document.getElementsByName('cual') [x].value);}}


This javascript works fine, when i run the Main Frame as separate instance, or another browser window.

As the buttons of the program are in the top frame, i can't get the window.frames.mainFrame.document.etc values, based on a security reasons.

Are there any way to connect actions within top frame with data at mainFrame ?

Any ideas ?

Thanks in advance,
David de Argentina

Re: How to get data from another frame ?

PostPosted: Mon Aug 31, 2015 3:06 pm
by David de Argentina
This line of code does de job:

Syntax: [ Download ] [ Hide ]
Using Javascript Syntax Highlighting
window.parent.frames[1].document.getElementsByName('cual')[x].checked)
Parsed in 0.003 seconds, using GeSHi 1.0.8.10


greetings from Buenos Aires,
David de Argentina