O formulário pai recebe iframe
window.iframeID
iframe recebe a janela dos pais
window.parent
parent.html
A cópia do código é a seguinte:
<! Doctype html public "-// w3c // dtd html 4.01 transitório // pt" "http://www.w3.org/tr/html4/loose.dtd">
<html>
<head>
<meta http-equiv = "content-type" content = "text/html; charset = utf-8">
<title> Insira o título aqui </ititure>
<script type = "text/javascript">
função btnfn () {
window.subwin.test ();
}
função get (nome) {
retornar document.getElementById (nome);
}
</script>
</head>
<Body>
<input id = "name" type = "text" value = "222">
<input type = "button" id = "btn" value = "click" onclick = "btnfn ();"> <br/>
<br/> <br/>
<iframe src = "sub.html" id = "subwin"
name = "subwin" marginwidth = "0"
margnenheight = "0" rolling = "sim" framebring = "0" valign = "meio"
REDIMENTE = "NO" style = "Display: Block; Border: 3px Solid Red;"> </frame>
</body>
</html>
Sub.html
A cópia do código é a seguinte:
<! Doctype html public "-// w3c // dtd html 4.01 transitório // pt" "http://www.w3.org/tr/html4/loose.dtd">
<html>
<head>
<meta http-equiv = "content-type" content = "text/html; charset = utf-8">
<title> Insira o título aqui </ititure>
<script type = "text/javascript">
function test () {
alert (window.parent.get ("nome"). valor); // resultado: 222
}
</script>
</head>
<Body>
Eu sou o conteúdo do formulário
</body>
</html>