Let’s suppose for your example the following structure:
start.html
h1.html (iframe menu)
function alterarInput()...
h2.html (iframe resto)
<input id="input1" />
In any of iframes
, you can access the page Parent (start) with Javascript
, and then any page element Parent, including the iframes
. So in the example I put in Function who is in the iframe
menu, let’s access the input
of iframe
rest like this:
function alterarInput() {
parent.resto.document.getElementById('input1').value= 'novo valor';
}
Note: avoid using iframes
, they are obsolete and the permissions of some browsers can make them not work. If you need to use separate files there are other more modern alternatives.
You can pass the variable by post and the text will be the received variable if it exists, vc does it using php and html
– Woton Sampaio
Why are you using
frame
andframeset
? Ps.: Both are deprecated.– Valdeir Psr
@Valdemir I’m a beginner, but doing what I’m in the same html will be tiring and disorganized. Woton Sampaio give an example, I’ve never used php xD
– Raptador
@Kidnapper I’m really not getting even with the
contentDocument
, browser is blocking access, I removed the answer while searching for a solution :) A question. You use jQuery?– Vinícius Lima
I have imported, but I can not use alone, if you have a code ready.
– Raptador