Javascript et les frames?!!!
Fermé
chichou
-
1 août 2002 à 14:26
HackTrack Messages postés 618 Date d'inscription vendredi 26 juillet 2002 Statut Membre Dernière intervention 13 juillet 2013 - 2 août 2002 à 09:11
HackTrack Messages postés 618 Date d'inscription vendredi 26 juillet 2002 Statut Membre Dernière intervention 13 juillet 2013 - 2 août 2002 à 09:11
A voir également:
- Javascript et les frames?!!!
- Telecharger javascript - Télécharger - Langages
- Javascript round ✓ - Forum Javascript
- Table de multiplication javascript ✓ - Forum Javascript
- Onclick javascript - Astuces et Solutions
- Javascript est activé mais ne fonctionne pas ✓ - Forum Internet / Réseaux sociaux
1 réponse
HackTrack
Messages postés
618
Date d'inscription
vendredi 26 juillet 2002
Statut
Membre
Dernière intervention
13 juillet 2013
972
2 août 2002 à 09:11
2 août 2002 à 09:11
index.html:
========
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Frame tester</title>
</head>
<frameset name="parent" rows="20%,*" border="0">
<frame name="topframe" src="top.html" scrolling="no"/>
<frame name="mainframe" src="main.html" scrolling="no" />
</frameset>
</html>
top.html:
=======
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Top</title>
</head>
<body>
<form name ="topForm" action = "aPage.html">
$i value is  <input id ="iValue" type="text" />
</form>
</body>
</html>
main.html:
========
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Main</title>
<script>
<!-- $i doit être récupéré du script PHP, il est stocké ici statiquement juste pour donner un exemple -->
var iVal = 12;
function loadValue(){
var topFrame = parent.frames('topframe');
topFrame.document.getElementById('iValue').value = iVal;
return iVal;
}
<!-- Cette fonction remplace la génération du tableau par ton script dans cet exemple -->
function buildTable(rowsCount){
var table = "<table>";
for(var i=0; i<rowsCount; i++){
var lineCount = i+1;
table += "<tr>";
table += "<td>Ligne"+lineCount+" Colonne 1</td>";
table += "<td>Ligne"+lineCount+" Colonne 2</td>";
table += "<td>Ligne"+lineCount+" Colonne 3</td>";
table += "<td>Ligne"+lineCount+" Colonne 4</td>";
table += "</tr>";
}
table += "</table>";
document.write(table);
}
</script>
</head>
<body onLoad="var x = loadValue(); buildTable(x);">
</body>
</html>
;-)
HackTrack
========
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Frame tester</title>
</head>
<frameset name="parent" rows="20%,*" border="0">
<frame name="topframe" src="top.html" scrolling="no"/>
<frame name="mainframe" src="main.html" scrolling="no" />
</frameset>
</html>
top.html:
=======
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Top</title>
</head>
<body>
<form name ="topForm" action = "aPage.html">
$i value is  <input id ="iValue" type="text" />
</form>
</body>
</html>
main.html:
========
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Main</title>
<script>
<!-- $i doit être récupéré du script PHP, il est stocké ici statiquement juste pour donner un exemple -->
var iVal = 12;
function loadValue(){
var topFrame = parent.frames('topframe');
topFrame.document.getElementById('iValue').value = iVal;
return iVal;
}
<!-- Cette fonction remplace la génération du tableau par ton script dans cet exemple -->
function buildTable(rowsCount){
var table = "<table>";
for(var i=0; i<rowsCount; i++){
var lineCount = i+1;
table += "<tr>";
table += "<td>Ligne"+lineCount+" Colonne 1</td>";
table += "<td>Ligne"+lineCount+" Colonne 2</td>";
table += "<td>Ligne"+lineCount+" Colonne 3</td>";
table += "<td>Ligne"+lineCount+" Colonne 4</td>";
table += "</tr>";
}
table += "</table>";
document.write(table);
}
</script>
</head>
<body onLoad="var x = loadValue(); buildTable(x);">
</body>
</html>
;-)
HackTrack