IE Metode:
document.frames ['myframe'].
Metode Firefox:
Document.getElementById ('MyFrame').
Yaitu, metode firefox:
Salin kode kode sebagai berikut:
function getValue () {
var tmp = '';
if (document.frames) {
TMP += 'IE mengatakan:';
tmp += document.frames ['myframe'].
} Kalau tidak {
tmp = document.getElementById ('myframe').
}
Peringatan (TMP);
}
Contoh kode:
Kode di halaman A.html
Salin kode kode sebagai berikut:
<Html>
<head>
<meta http-equiv = "konten tipe" content = "text/html; charset = utf-8">
<title>
JavaScript Dapatkan uji nilai elemen di halaman di iframe
</title>
</head>
<body>
<iframe id = "myframe" src = 'b.html'> </iframe>
<input type = "tombol" id = "btn" ontClick = "getValue ()" value = "test">
<type skrip = "Teks/JavaScript">
function getValue () {
var tmp = '';
if (document.frames) {
TMP += 'IE mengatakan:';
tmp += document.frames ['myframe'].
} Kalau tidak {
tmp = document.getElementById ('myframe').
}
Peringatan (TMP);
}
</script>
</body>
</html>
Kode di halaman B.html
Salin kode kode sebagai berikut:
<Html>
<head>
<meta http-equiv = "konten tipe" content = "text/html; charset = utf-8">
<title>
Saya adalah halaman di iframe
</title>
</head>
<body>
<input type = 'text' id = "test" value = 'Selamat datang untuk mengunjungi: justflyhigh.com'>
</body>
</html>