Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    posizione di campi text in una scroll

    ciao ragazzi avrei bisogno del vostro aiuto!!! ho una tabella con 40 campi text in un div e vorrei calcolare la posizione di ogni elemento(campo text).in pratica quando scrollo la pagina il primo elemento non si troverà più nella stessa posizione ma sarà scrollato,io ho bisogno di sapere la posizione dell'elemento anche quando è scrollato.vi posto il codice aspetto notizie.

    <html>
    <head>
    <title>tabella</title>

    <SCRIPT type="text/javascript">








    function prova(){
    var contenitore=document.getElementById('pippo');
    alert(contenitore.scrollTop);
    }

    function visualizza() {

    document.getElementById('ccc').innerHTML=window.op en('www.html.it','prova','width=100,height=90,left =550,top=150');


    }


    </script>

    </head>
    <body>
    <form name="uno" action="">
    <center><div id="pippo" style="width:450px;height:200px; overflow-x:scroll; overflow-y:scroll;border:1px solid black;">

    <table cellpadding="4" cellspacing="1" width="120%" border=0>

    <tr>
    <td width=20% height="40" valign="bottom"><input type="text" onfocus ="visualizza();">
    <td width=40% id="ccc" height="40" valign="top"></td>
    </td>
    </div>
    </tr>


    <tr>
    <td width=20%><input type="text" name="txt" id="txtdue" >
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="txtuno">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" id="txtuno">
    </td>
    </tr>
    </div>
    <tr>
    <td width=20%><input type="text" name="5">
    </td>
    </tr>


    <tr>
    <td width=20%><input type="text" name="6">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="7">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="8">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="9">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="10">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="11">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="12">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="13">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="14">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="15">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="16">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="17">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="18">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="19">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="20">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="21">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="22">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="23">
    </td>
    </tr>


    <tr>
    <td width=20%><input type="text" name="24">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="25">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="26">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="27">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="28">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="29">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="30">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="31">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="32">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="33">
    </td>
    </tr>


    <tr>
    <td width=20%><input type="text" name="34">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="35">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="36">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="37">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="38">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="39">
    </td>
    </tr>

    <tr>
    <td width=20%><input type="text" name="40">
    </td>
    </tr>
    </table>
    </center>

    </form>






    <center>
    <form action="">





    <input type="button" value="Coordinate" onclick="prova();">

    </form>
    </div>
    </center>

    </body>
    </html>

  2. #2
    per fare un esempio: il primo campo text si trova in posizione x e y rispettivamente 288 e 25 se io scrollo la pagina per andare in giù il campo text andrà in su quindi dovrà diminuire il valore di y. aspetto con ansia una risposta !!

  3. #3
    Utente di HTML.it L'avatar di Xinod
    Registrato dal
    Sep 2000
    Messaggi
    13,649
    come ti faccio notare per la seconda volta,
    ritrova la discussione dove hai gia' ricevuto una risposta e continua li'

    in quella discussione, dopo averti fornito le istruzioni necessarie alla risoluzione del problema, mi sembrava mancasse solo da fare una sottrazione,
    cosa che si spera tu sia in grado di fare senza chiedere insistentemente l' aiuto del forum

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.