Javascript et les frames?!!!

chichou -  
 Utilisateur anonyme -
Bonjour,
j'ai une page html comprenant 2 frames: une "topframe et une "mainframe. dans la "mainframe j'ouvre une page php qui génere un tableau de MySQL à "$i" nombre de ligne et dans la topFrame je voudrais stocker ma variable "$i" dans un champ de formulaire.
?: comment envoyer la valeur de $i du script php de la mainframe DANS le fomulaire de la topframe??????

1 réponse

  1. Utilisateur anonyme
     
    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&nbsp <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
    1