Dh Methode:
document.frames ['MyFrame'].
Firefox -Methode:
document.getElementById ('MyFrame').
Dh Firefox -Methode:
Kopieren Sie den Code -Code wie folgt:
Funktion getValue () {
var tmp = '';
if (document.frames) {
Tmp += 'dh sagte:';
tmp += document.frames ['MyFrame'].
} Anders {
tmp = document.getElementById ('MyFrame').
}
Alarm (TMP);
}
Beispielcode:
Der Code auf der A.HTML -Seite
Kopieren Sie den Code -Code wie folgt:
<html>
<kopf>
<meta http-äquiv = "content-type" content = "text/html; charset = utf-8">
<title>
JavaScript erhalten Sie den Werttest des Elements auf der Seite in Iframe
</Title>
</head>
<body>
<iframe id = "MyFrame" src = 'b.html'> </iframe>
<input type = "button" id = "btn" onclick = "getValue ()" value = "test">
<script type = "text/javaScript">
Funktion getValue () {
var tmp = '';
if (document.frames) {
Tmp += 'dh sagte:';
tmp += document.frames ['MyFrame'].
} Anders {
tmp = document.getElementById ('MyFrame').
}
Alarm (TMP);
}
</script>
</body>
</html>
Code in b.html Seite
Kopieren Sie den Code -Code wie folgt:
<html>
<kopf>
<meta http-äquiv = "content-type" content = "text/html; charset = utf-8">
<title>
Ich bin eine Seite in Iframe
</Title>
</head>
<body>
<Eingabe type = 'text' id = "test" value = 'Willkommen zu Besuch: justflyhigh.com'>
</body>
</html>