Tecnologia

Fazer iframe acessar página pai e vice-versa

Página:


<script>
var abc = 10;

var ifrm = document.getElementById('iframe_target');
var doc = ifrm.contentDocument? ifrm.contentDocument: ifrm.contentWindow.document;	
var form = doc.getElementById('iframe_form');
form.nome.value = "Anderson";

if (objparent)
	objparent.x();
</script>

<iframe id="iframte_target" source=""></iframe>

Iframe:


<script>
alert(parent.abc);

parent.objparent = window;

function x() {
	alert('oi');
}
</script>

<form id="iframe_form">
	<input type="text" id="nome">
</form>
2020 © B85 Tecnologia
eu@andersonbravo.com.br