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

    Javascript: scrivere in textarea da un capo di testo separato ed eliminare entry

    Ciao a tutti,
    ho creato una pagina strutturata in questo modo:
    ho una listbox e due campi di testo che riempio ed il cui output compare concatenato su di un
    altro campo. Nello specifico ho un drop down menù da cui seleziono il Grado (App, Mar, Com) ed altri tre campi si cui scrivo Nome, Cognome e Matricola.
    Vorrei questi 4 inserimenti comparissero concatenati in un campo unico sotto:
    Mar. Rossi Alberto w347611 (ad esempio)
    Cliccando poi su di un pulsante AGGIUNGI questa riga viene di fatto aggiunta ad una linea della mia
    textarea. Posso quindi procedere con altri inserimenti.
    Quando ho finito vorrei che cliccando sul pulsante Submit in basso alla pagina il contenuto della textarea venite salvato su di un file in locale, ad esempio c:\utenti.txt


    Questa è parte del codice che ho scritto ma che on funziona...e non capisco dove sbaglio:

    newuser.html

    codice HTML:
    <html>
     <head>
     <style type="text/css">
     .auto-style1 {
     text-align: left;
     color: #0000FF;
     }
     .auto-style3 {
      text-align: center;
      color: #D01A1A;
     background-color: #FFFFFF;
     }
     .auto-style4 {
     text-align: center;
     }
    .auto-style5 {
     text-align: center;
     color: #0000FF;
    }
     .auto-style6 {
      text-align: center;
      color: #0000FF;
      font-size: x-large;
      background-color: #FFFFFF;
     }
     .auto-style9 {
      background-color: #FFFFFF;
      color: #0000FF;
     }
     .auto-style8 {
      border-width: 0;
     }
     .auto-style12 {
     text-align: left;
     background-color: #FFFFFF;
     font-family: Arial, Helvetica, sans-serif;
     font-size: small;
    }
    .auto-style14 {
     background-color: #FFFFFF;
    }
    .auto-style16 {
     font-family: Arial, Helvetica, sans-serif;
     font-size: small;
    }
    .auto-style17 {
     text-align: center;
     color: #000080;
     font-family: Arial, Helvetica, sans-serif;
    }
    .auto-style18 {
     text-align: center;
     background-color: #FFFFFF;
     font-family: Arial, Helvetica, sans-serif;
     font-size: small;
    }
    .auto-style19 {
     font-size: small;
    }
    .auto-style20 {
     text-align: center;
     color: #000080;
     font-family: Arial, Helvetica, sans-serif;
     font-size: small;
    }
     .auto-style24 {
      text-align: left;
      color: #000080;
      font-family: Arial, Helvetica, sans-serif;
      font-size: small;
     }
     </style>
    </head>
    <body style="background-color: #99CCFF">
    <div class="auto-style4">
    <p>&nbsp;</p>
    <table style="width: 60%" align="center" class="auto-style6">
     <tr>
      <td class="auto-style3"><strong>
      <img alt="" height="163" src="logo_lazarus.png" width="385"><br>
      <span class="auto-style9">C4I Onboard Lazarus</span><span class="u"><br>
      </span></strong><span class="u"><strong>Inserimento operatori C4I di 
      bordo</strong></span></td>
     </tr>
     <tr>
      <td class="auto-style14">
      <img alt="" class="auto-style5" height="229" src="newusers.jpg" width="220" /></td>
     </tr>
     <tr>
      <td>&nbsp;</td>
     </tr>
     <tr>
      <td class="auto-style14"><form id="imbarcazioni" name="imbarcazioni" method="post" action="prepare.php" >
        <div class="auto-style4">
      <table border="0" align="center" cellpadding="2" cellspacing="0" style="height: 396px; width: 439px;" class="auto-style14">
        <tr>
          <td class="auto-style24" style="width: 91px">
     
       <strong>Grado</strong>
     
    <span class="auto-style16"> &nbsp;</span></td>
          <td width="188" class="auto-style24" style="width: 94px">
     
    <select name="grado" id="grado" " class="auto-style16">
        <optgroup label="Grado">
            <option value="Aps.">Aps.</option>
            <option value="Maa.">Maa.</option>
            <option value="Mac.">Mac.</option>
            </optgroup>
            </select></td>
        </tr>
        <tr>
          <td class="auto-style24" style="width: 91px">
     
       <strong>Nome</strong></td>
          <td width="188" class="auto-style20" style="width: 94px">
       <input name="nome" type="text" class="auto-style79" value="" id="nome" style="width: 200px" /></td>
        </tr>
        <tr>
          <td class="auto-style24" style="width: 91px">
     
       <strong>Cognome</strong></td>
          <td width="188" class="auto-style20" style="width: 94px">
       <input name="cognome" type="text" class="auto-style79" id="cognome" value="" style="width: 200px" /></td>
        </tr>
        <tr>
          <td class="auto-style24" style="width: 91px">
     
       <strong>Matricola</strong></td>
          <td width="188" class="auto-style20" style="width: 94px">
       <input name="matricola" type="text" class="auto-style79" id="matricola" value="" style="width: 200px" /></td>
        </tr>
        <tr>
          <td class="auto-style24" colspan="2">
     
       <input type="text" id="dest" style="width: 328px" name="dest" value=""><input name="Submit1" type="submit" value="Aggiungi" /></td>
     </tr>
          <tr>
          <td class="auto-style18" colspan="2"> <div id="txtHint" class="auto-style17">
        <p class="auto-style19"><span class="auto-style16"> 
       <textarea name="lista_utenti" id="lista_utenti" cols="50" rows="10"></textarea></span></p>
        <p class="auto-style19"><span class="auto-style16"> 
        <input name="Submit0" type="submit" value="Rimuovi utente selezionato"></span></p>
       </div></td>
        </tr>
        <tr class="auto-style1">
          <td class="auto-style12" colspan="2">
       <p class="auto-style4">
       <br class="auto-style16">
     <input name="Submit" type="submit" value="Inserisci lista utenti"><br class="auto-style16">
         </p>
         </td>
        </tr>
        </table>
        </div>
        </form>
               </tr>
      </table>
     &nbsp;<br>
       <br />
     <tr>
      <td><a href="index.html">
      <img alt="" class="auto-style8" height="58" src="home.png" width="58"></a></td>
     </tr>
     <tr>
      <td>&nbsp;</td>
     </tr>
     <tr>
      <td class="auto-style11">
      <br>
      <img alt="" height="48" src="almaviva.jpg" width="200"></td>
     </tr>
    </div>
    </body>   
    <script type="text/javascript">
    $(document).ready(function(){
        $("#matricola, #grado, #nome, #cognome").change(function(){
            concatenated_string = $("#matricola").val() + " " + $("#grado").val() + " " + $("#nome").val() + " " + $("#cognome").val();
            $("#dest").val(concatenated_string);
           })
    })
    </script>
    </html>
    Ogni consiglio sarà ben accetto!

    Grazie!!

    Tiziano

  2. #2
    Scusatemi avevo incollato un codice errato!
    Ecco il corretto:

    codice HTML:
    <html>
     <head>
     <style type="text/css">
     .auto-style1 {
     text-align: left;
     color: #0000FF;
     }
     .auto-style3 {
      text-align: center;
      color: #D01A1A;
     background-color: #FFFFFF;
     }
     .auto-style4 {
     text-align: center;
     }
    .auto-style5 {
     text-align: center;
     color: #0000FF;
    }
     .auto-style6 {
      text-align: center;
      color: #0000FF;
      font-size: x-large;
      background-color: #FFFFFF;
     }
     .auto-style9 {
      background-color: #FFFFFF;
      color: #0000FF;
     }
     .auto-style8 {
      border-width: 0;
     }
     .auto-style12 {
     text-align: left;
     background-color: #FFFFFF;
     font-family: Arial, Helvetica, sans-serif;
     font-size: small;
    }
    .auto-style14 {
     background-color: #FFFFFF;
    }
    .auto-style16 {
     font-family: Arial, Helvetica, sans-serif;
     font-size: small;
    }
    .auto-style17 {
     text-align: center;
     color: #000080;
     font-family: Arial, Helvetica, sans-serif;
    }
    .auto-style18 {
     text-align: center;
     background-color: #FFFFFF;
     font-family: Arial, Helvetica, sans-serif;
     font-size: small;
    }
    .auto-style19 {
     font-size: small;
    }
    .auto-style20 {
     text-align: center;
     color: #000080;
     font-family: Arial, Helvetica, sans-serif;
     font-size: small;
    }
     .auto-style24 {
      text-align: left;
      color: #000080;
      font-family: Arial, Helvetica, sans-serif;
      font-size: small;
     }
     </style>
    </head>
    <body style="background-color: #99CCFF">
    <div class="auto-style4">
    <p>&nbsp;</p>
    <table style="width: 60%" align="center" class="auto-style6">
     <tr>
      <td class="auto-style3"><strong>
      <img alt="" height="163" src="logo_lazarus.png" width="385"><br>
      <span class="auto-style9">C4I Onboard Lazarus</span><span class="u"><br>
      </span></strong><span class="u"><strong>Inserimento operatori C4I di 
      bordo</strong></span></td>
     </tr>
     <tr>
      <td class="auto-style14">
      <img alt="" class="auto-style5" height="229" src="newusers.jpg" width="220" /></td>
     </tr>
     <tr>
      <td>&nbsp;</td>
     </tr>
     <tr>
      <td class="auto-style14"><form id="imbarcazioni" name="imbarcazioni" method="post" action="prepare.php" >
        <div class="auto-style4">
      <table border="0" align="center" cellpadding="2" cellspacing="0" style="height: 396px; width: 439px;" class="auto-style14">
        <tr>
          <td class="auto-style24" style="width: 91px">
     
       <strong>Grado</strong>
     
    <span class="auto-style16"> &nbsp;</span></td>
          <td width="188" class="auto-style24" style="width: 94px">
     
    <select name="grado" id="grado" onkeypress="generateFullName()" class="auto-style16">
        <optgroup label="Grado">
            <option value="Aps.">Aps.</option>
            <option value="Maa.">Maa.</option>
            <option value="Mac.">Mac.</option>
            </optgroup>
            </select></td>
        </tr>
        <tr>
          <td class="auto-style24" style="width: 91px">
     
       <strong>Nome</strong></td>
          <td width="188" class="auto-style20" style="width: 94px">
       <input name="nome" type="text" class="auto-style79" onkeyup="generateFullName()" id="nome" style="width: 200px"></td>
        </tr>
        <tr>
          <td class="auto-style24" style="width: 91px">
     
       <strong>Cognome</strong></td>
          <td width="188" class="auto-style20" style="width: 94px">
       <input name="cognome" type="text" class="auto-style79" id="cognome" onkeyup="generateFullName()" style="width: 200px"></td>
        </tr>
        <tr>
          <td class="auto-style24" style="width: 91px">
     
       <strong>Matricola</strong></td>
          <td width="188" class="auto-style20" style="width: 94px">
       <input name="matricola" type="text" class="auto-style79" id="matricola" onkeyup="generateFullName()" style="width: 200px"></td>
        </tr>
        <tr>
          <td class="auto-style24" colspan="2">
     
       <input type="text" id="dest" style="width: 328px" name="dest" value=""><input type="button" value="Aggiungi" onclick="addtext();"></td>
     </tr>
          <tr>
          <td class="auto-style18" colspan="2"> <div id="txtHint" class="auto-style17">
        <p class="auto-style19"><span class="auto-style16"> 
       <textarea name="lista_utenti" id="lista_utenti" cols="50" rows="10"></textarea></span></p>
        <p class="auto-style19"><span class="auto-style16"> 
        <input name="Submit0" type="submit" value="Rimuovi utente selezionato"></span></p>
       </div></td>
        </tr>
        <tr class="auto-style1">
          <td class="auto-style12" colspan="2">
       <p class="auto-style4">
       <br class="auto-style16">
     <input name="Submit" type="submit" value="Inserisci lista utenti"><br class="auto-style16">
         </p>
         </td>
        </tr>
        </table>
        </div>
        </form>
               </tr>
      </table>
     &nbsp;<br>
       <br />
     <tr>
      <td><a href="index.html">
      <img alt="" class="auto-style8" height="58" src="home.png" width="58"></a></td>
     </tr>
     <tr>
      <td>&nbsp;</td>
     </tr>
     <tr>
      <td class="auto-style11">
      <br>
      <img alt="" height="48" src="almaviva.jpg" width="200"></td>
     </tr>
    </div>
    </body>   
    <script type="text/javascript">
        function generateFullName()
        {
            document.getElementById('dest').innerText = 
                document.getElementById('matricola').value + ' ' + 
                document.getElementById('nome').value+ ' ' + 
                document.getElementById('cognome').value+ ' ' + 
                document.getElementById('grado').value;
        };
    function InserisciTesto(testo){
        document.getElementById("lista_utenti").value += testo;
    };
    function addtext() {
     var newtext = document.imbarcazioni.dest.value;
     document.imbarcazioni.lista_utenti.value += newtext;
    }
    </script>
    </html>
    Sostanzialmente a questo codice va fatta la seguente correzione:
    1)Quando inserisco le linee nella textarea vorrei venissero inserite su righe diverse;
    2)Cliccando sul pulsante in basso vorrei salvare il contenuto della textarea su di un file di testo in locale;
    Come fare?

    Saluti


    Quote Originariamente inviata da Tulipan0nero Visualizza il messaggio
    Ciao a tutti,
    ho creato una pagina strutturata in questo modo:
    ho una listbox e due campi di testo che riempio ed il cui output compare concatenato su di un
    altro campo. Nello specifico ho un drop down menù da cui seleziono il Grado (App, Mar, Com) ed altri tre campi si cui scrivo Nome, Cognome e Matricola.
    Vorrei questi 4 inserimenti comparissero concatenati in un campo unico sotto:
    Mar. Rossi Alberto w347611 (ad esempio)
    Cliccando poi su di un pulsante AGGIUNGI questa riga viene di fatto aggiunta ad una linea della mia
    textarea. Posso quindi procedere con altri inserimenti.
    Quando ho finito vorrei che cliccando sul pulsante Submit in basso alla pagina il contenuto della textarea venite salvato su di un file in locale, ad esempio c:\utenti.txt


    Questa è parte del codice che ho scritto ma che on funziona...e non capisco dove sbaglio:

    newuser.html

    codice HTML:
    <html>
     <head>
     <style type="text/css">
     .auto-style1 {
     text-align: left;
     color: #0000FF;
     }
     .auto-style3 {
      text-align: center;
      color: #D01A1A;
     background-color: #FFFFFF;
     }
     .auto-style4 {
     text-align: center;
     }
    .auto-style5 {
     text-align: center;
     color: #0000FF;
    }
     .auto-style6 {
      text-align: center;
      color: #0000FF;
      font-size: x-large;
      background-color: #FFFFFF;
     }
     .auto-style9 {
      background-color: #FFFFFF;
      color: #0000FF;
     }
     .auto-style8 {
      border-width: 0;
     }
     .auto-style12 {
     text-align: left;
     background-color: #FFFFFF;
     font-family: Arial, Helvetica, sans-serif;
     font-size: small;
    }
    .auto-style14 {
     background-color: #FFFFFF;
    }
    .auto-style16 {
     font-family: Arial, Helvetica, sans-serif;
     font-size: small;
    }
    .auto-style17 {
     text-align: center;
     color: #000080;
     font-family: Arial, Helvetica, sans-serif;
    }
    .auto-style18 {
     text-align: center;
     background-color: #FFFFFF;
     font-family: Arial, Helvetica, sans-serif;
     font-size: small;
    }
    .auto-style19 {
     font-size: small;
    }
    .auto-style20 {
     text-align: center;
     color: #000080;
     font-family: Arial, Helvetica, sans-serif;
     font-size: small;
    }
     .auto-style24 {
      text-align: left;
      color: #000080;
      font-family: Arial, Helvetica, sans-serif;
      font-size: small;
     }
     </style>
    </head>
    <body style="background-color: #99CCFF">
    <div class="auto-style4">
    <p>&nbsp;</p>
    <table style="width: 60%" align="center" class="auto-style6">
     <tr>
      <td class="auto-style3"><strong>
      <img alt="" height="163" src="logo_lazarus.png" width="385"><br>
      <span class="auto-style9">C4I Onboard Lazarus</span><span class="u"><br>
      </span></strong><span class="u"><strong>Inserimento operatori C4I di 
      bordo</strong></span></td>
     </tr>
     <tr>
      <td class="auto-style14">
      <img alt="" class="auto-style5" height="229" src="newusers.jpg" width="220" /></td>
     </tr>
     <tr>
      <td>&nbsp;</td>
     </tr>
     <tr>
      <td class="auto-style14"><form id="imbarcazioni" name="imbarcazioni" method="post" action="prepare.php" >
        <div class="auto-style4">
      <table border="0" align="center" cellpadding="2" cellspacing="0" style="height: 396px; width: 439px;" class="auto-style14">
        <tr>
          <td class="auto-style24" style="width: 91px">
     
       <strong>Grado</strong>
     
    <span class="auto-style16"> &nbsp;</span></td>
          <td width="188" class="auto-style24" style="width: 94px">
     
    <select name="grado" id="grado" " class="auto-style16">
        <optgroup label="Grado">
            <option value="Aps.">Aps.</option>
            <option value="Maa.">Maa.</option>
            <option value="Mac.">Mac.</option>
            </optgroup>
            </select></td>
        </tr>
        <tr>
          <td class="auto-style24" style="width: 91px">
     
       <strong>Nome</strong></td>
          <td width="188" class="auto-style20" style="width: 94px">
       <input name="nome" type="text" class="auto-style79" value="" id="nome" style="width: 200px" /></td>
        </tr>
        <tr>
          <td class="auto-style24" style="width: 91px">
     
       <strong>Cognome</strong></td>
          <td width="188" class="auto-style20" style="width: 94px">
       <input name="cognome" type="text" class="auto-style79" id="cognome" value="" style="width: 200px" /></td>
        </tr>
        <tr>
          <td class="auto-style24" style="width: 91px">
     
       <strong>Matricola</strong></td>
          <td width="188" class="auto-style20" style="width: 94px">
       <input name="matricola" type="text" class="auto-style79" id="matricola" value="" style="width: 200px" /></td>
        </tr>
        <tr>
          <td class="auto-style24" colspan="2">
     
       <input type="text" id="dest" style="width: 328px" name="dest" value=""><input name="Submit1" type="submit" value="Aggiungi" /></td>
     </tr>
          <tr>
          <td class="auto-style18" colspan="2"> <div id="txtHint" class="auto-style17">
        <p class="auto-style19"><span class="auto-style16"> 
       <textarea name="lista_utenti" id="lista_utenti" cols="50" rows="10"></textarea></span></p>
        <p class="auto-style19"><span class="auto-style16"> 
        <input name="Submit0" type="submit" value="Rimuovi utente selezionato"></span></p>
       </div></td>
        </tr>
        <tr class="auto-style1">
          <td class="auto-style12" colspan="2">
       <p class="auto-style4">
       <br class="auto-style16">
     <input name="Submit" type="submit" value="Inserisci lista utenti"><br class="auto-style16">
         </p>
         </td>
        </tr>
        </table>
        </div>
        </form>
               </tr>
      </table>
     &nbsp;<br>
       <br />
     <tr>
      <td><a href="index.html">
      <img alt="" class="auto-style8" height="58" src="home.png" width="58"></a></td>
     </tr>
     <tr>
      <td>&nbsp;</td>
     </tr>
     <tr>
      <td class="auto-style11">
      <br>
      <img alt="" height="48" src="almaviva.jpg" width="200"></td>
     </tr>
    </div>
    </body>   
    <script type="text/javascript">
    $(document).ready(function(){
        $("#matricola, #grado, #nome, #cognome").change(function(){
            concatenated_string = $("#matricola").val() + " " + $("#grado").val() + " " + $("#nome").val() + " " + $("#cognome").val();
            $("#dest").val(concatenated_string);
           })
    })
    </script>
    </html>
    Ogni consiglio sarà ben accetto!

    Grazie!!

    Tiziano

  3. #3
    Codice ulteriormente affinato: adesso salvo il contenuto della text area in un file di testo.
    Mi servirebbe una mano a capire come inserire le entry nella textarea su linee diverse di
    modo che poi il file di testo che viene generato mostri le linee incolonnate e non affiancate come adesso....Si può fare?
    Inoltre vorrei che il bottone accanto alla text area cancellasse al click le linea che ho
    evidenziato nella textarea...come farlo?

    codice HTML:
    <html>
     <head>
     <style type="text/css">
     .auto-style1 {
     text-align: left;
     color: #0000FF;
     }
     .auto-style3 {
      text-align: center;
      color: #D01A1A;
     background-color: #FFFFFF;
     }
     .auto-style4 {
     text-align: center;
     }
    .auto-style5 {
     text-align: center;
     color: #0000FF;
    }
     .auto-style6 {
      text-align: center;
      color: #0000FF;
      font-size: x-large;
      background-color: #FFFFFF;
     }
     .auto-style9 {
      background-color: #FFFFFF;
      color: #0000FF;
     }
     .auto-style8 {
      border-width: 0;
     }
     .auto-style12 {
     text-align: left;
     background-color: #FFFFFF;
     font-family: Arial, Helvetica, sans-serif;
     font-size: small;
    }
    .auto-style14 {
     background-color: #FFFFFF;
    }
    .auto-style16 {
     font-family: Arial, Helvetica, sans-serif;
     font-size: small;
    }
    .auto-style17 {
     text-align: center;
     color: #000080;
     font-family: Arial, Helvetica, sans-serif;
    }
    .auto-style18 {
     text-align: center;
     background-color: #FFFFFF;
     font-family: Arial, Helvetica, sans-serif;
     font-size: small;
    }
    .auto-style19 {
     font-size: small;
    }
    .auto-style20 {
     text-align: center;
     color: #000080;
     font-family: Arial, Helvetica, sans-serif;
     font-size: small;
    }
     .auto-style24 {
      text-align: left;
      color: #000080;
      font-family: Arial, Helvetica, sans-serif;
      font-size: small;
     }
     </style>
    </head>
    <body style="background-color: #99CCFF">
    <div class="auto-style4">
    <p>&nbsp;</p>
    <table style="width: 60%" align="center" class="auto-style6">
     <tr>
      <td class="auto-style3"><strong>
      <img alt="" height="163" src="logo_lazarus.png" width="385"><br>
      <span class="auto-style9">C4I Onboard Lazarus</span><span class="u"><br>
      </span></strong><span class="u"><strong>Inserimento operatori C4I di 
      bordo</strong></span></td>
     </tr>
     <tr>
      <td class="auto-style14">
      <img alt="" class="auto-style5" height="229" src="newusers.jpg" width="220" /></td>
     </tr>
     <tr>
      <td>&nbsp;</td>
     </tr>
     <tr>
      <td class="auto-style14"><form id="imbarcazioni" name="imbarcazioni" method="post" action="prepare.php" >
        <div class="auto-style4">
      <table border="0" align="center" cellpadding="2" cellspacing="0" style="height: 396px; width: 439px;" class="auto-style14">
        <tr>
          <td class="auto-style24" style="width: 91px">
     
       <strong>Grado</strong>
     
    <span class="auto-style16"> &nbsp;</span></td>
          <td width="188" class="auto-style24" style="width: 94px">
     
    <select name="grado" id="grado" onkeypress="generateFullName()" class="auto-style16">
        <optgroup label="Grado">
            <option value="Aps.">Aps.</option>
            <option value="Maa.">Maa.</option>
            <option value="Mac.">Mac.</option>
            </optgroup>
            </select></td>
        </tr>
        <tr>
          <td class="auto-style24" style="width: 91px">
     
       <strong>Nome</strong></td>
          <td width="188" class="auto-style20" style="width: 94px">
       <input name="nome" type="text" class="auto-style79" onkeyup="generateFullName()" id="nome" style="width: 200px"></td>
        </tr>
        <tr>
          <td class="auto-style24" style="width: 91px">
     
       <strong>Cognome</strong></td>
          <td width="188" class="auto-style20" style="width: 94px">
       <input name="cognome" type="text" class="auto-style79" id="cognome" onkeyup="generateFullName()" style="width: 200px"></td>
        </tr>
        <tr>
          <td class="auto-style24" style="width: 91px">
     
       <strong>Matricola</strong></td>
          <td width="188" class="auto-style20" style="width: 94px">
       <input name="matricola" type="text" class="auto-style79" id="matricola" onkeyup="generateFullName()" style="width: 200px"></td>
        </tr>
        <tr>
          <td class="auto-style24" colspan="2">
     
       <input type="text" id="dest" style="width: 328px" name="dest" value=""><input type="button" value="Aggiungi" onclick="addtext();"></td>
     </tr>
          <tr>
          <td class="auto-style18" colspan="2"> <div id="txtHint" class="auto-style17">
        <p class="auto-style19"><span class="auto-style16"> 
       <textarea name="lista_utenti" id="lista_utenti" cols="50" rows="10"></textarea></span></p>
        <p class="auto-style19"><span class="auto-style16"> 
        <input name="Submit0" type="submit" value="Rimuovi utente selezionato"></span></p>
       </div></td>
        </tr>
        <tr class="auto-style1">
          <td class="auto-style12" colspan="2">
       <p class="auto-style4">
       <br class="auto-style16">
     <input id="Button1" type="button" value="Inserisci lista utenti" onclick="WriteToFile()"><br class="auto-style16">
         </p>
         </td>
        </tr>
        </table>
        </div>
        </form>
               </tr>
      </table>
     &nbsp;<br>
       <br />
     <tr>
      <td><a href="index.html">
      <img alt="" class="auto-style8" height="58" src="home.png" width="58"></a></td>
     </tr>
     <tr>
      <td>&nbsp;</td>
     </tr>
     <tr>
      <td class="auto-style11">
      <br>
      <img alt="" height="48" src="almaviva.jpg" width="200"></td>
     </tr>
    </div>
    </body>   
    <script type="text/javascript">
        function generateFullName()
        {
            document.getElementById('dest').innerText = 
                document.getElementById('matricola').value + ' ' + 
                document.getElementById('nome').value+ ' ' + 
                document.getElementById('cognome').value+ ' ' + 
                document.getElementById('grado').value;
        };
    function InserisciTesto(testo){
        document.getElementById("lista_utenti").value += testo;
    };
    function addtext() {
     var newtext = document.imbarcazioni.dest.value;
     document.imbarcazioni.lista_utenti.value += newtext;
    };
    function WriteToFile()
     {
     var fso = new ActiveXObject("Scripting.FileSystemObject");
     var s = fso.CreateTextFile("C:\\temp\\Utenti.txt", true);
     var text=document.getElementById("lista_utenti").innerText;
     s.WriteLine(text);
     s.Close();
     }
    </script>
    </html>
    

  4. #4
    Moderatore di Annunci siti web, Offro lavoro/collaborazione, Cerco lavoro L'avatar di cavicchiandrea
    Registrato dal
    Aug 2001
    Messaggi
    26,133
    A scopo didattico ho sviluppato questo esempio ho eliminato la textarea perché dava diversi problemi e ho optato per degli input text uno sotto l'altro tipo lista (l'effetto è molto simile alla textarea) mentre per la creazione del file text ho preferito usare php per due motivi:
    - Non tutti i browser permetto di accedere al FileSystem
    - Non tutti i pc hanno il disco C:// (tipo gli utenti come me che sono su apple)
    ho sistemato alla meglio html cerano diversi errori ma c'è ancora da fare tipo <td width="188" class="auto-style20" style="width: 94px;"> (usi una classe dove potresti impostare una larghezza e non lo fai poi la forzi ben due con il primo width e non pago anche con lo stile in linea) consiglio passaggio ai div, attendo commenti in merito
    Cavicchi Andrea
    Problemi con javascript, jquery, ajax clicca qui

  5. #5
    Ciao Andrea,
    è PERFETTO!!! Grazie!!!! Potresti postare il codice? :-)

    Quote Originariamente inviata da cavicchiandrea Visualizza il messaggio
    A scopo didattico ho sviluppato questo esempio ho eliminato la textarea perché dava diversi problemi e ho optato per degli input text uno sotto l'altro tipo lista (l'effetto è molto simile alla textarea) mentre per la creazione del file text ho preferito usare php per due motivi:
    - Non tutti i browser permetto di accedere al FileSystem
    - Non tutti i pc hanno il disco C:// (tipo gli utenti come me che sono su apple)
    ho sistemato alla meglio html cerano diversi errori ma c'è ancora da fare tipo <td width="188" class="auto-style20" style="width: 94px;"> (usi una classe dove potresti impostare una larghezza e non lo fai poi la forzi ben due con il primo width e non pago anche con lo stile in linea) consiglio passaggio ai div, attendo commenti in merito

  6. #6
    Ho solo un problema: devo assolutamente salvare il testo in c:\temp\utenti.txt
    Chi usa la pagina non deve avere alcun prompt....deve andare tutto in automatico!

  7. #7
    Moderatore di Annunci siti web, Offro lavoro/collaborazione, Cerco lavoro L'avatar di cavicchiandrea
    Registrato dal
    Aug 2001
    Messaggi
    26,133
    C'e (quasi) tutto nel sorgente pagina è solo da "ripulire" un po', se vuoi lo zip completo mandami un privato con la mail

    Cavicchi Andrea
    Problemi con javascript, jquery, ajax clicca qui

  8. #8
    Quote Originariamente inviata da cavicchiandrea Visualizza il messaggio
    C'e (quasi) tutto nel sorgente pagina è solo da "ripulire" un po', se vuoi lo zip completo mandami un privato con la mail


    TI ho mandato un msg privato! Cmq la mia mail posso scriverla anche qua, no problem: saveconi@libero.it
    PEr quanto riguarda la ripulitura: fregatene... è un front end che stavo sviluppando per aiutarmi nel mio lavoro di tutti i giorni...anche se non perfetto va bene uguale

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.