Visualizzazione dei risultati da 1 a 3 su 3

Discussione: invio dati javaScript

  1. #1
    Utente di HTML.it L'avatar di vannicv
    Registrato dal
    Sep 2003
    Messaggi
    394

    invio dati javaScript

    Ciao a tutti,
    ho un proglema in javaScript spero che voi mi potere auitare o suggerie qualcosa di simile.
    Il mio sito non supporta asp e php

    Vorrei inserire delle caselle tipo name con i seguenti dati; Via, Città, N.Teleforno, N.Fax
    Spero in un vostro Aiuto
    Grazie a Tutti

    Il mio codice e' il seguente.

    <html>

    <head><script LANGUAGE="JavaScript">




    <!-- Begin
    function getCookie(name){
    var cname = name + "=";
    var dc = document.cookie;
    if (dc.length > 0) {
    begin = dc.indexOf(cname);
    if (begin != -1) {
    begin += cname.length;
    end = dc.indexOf(";", begin);
    if (end == -1) end = dc.length;
    return unescape(dc.substring(begin, end));
    }
    }
    return null;
    }
    function setCookie(name, value, expires) {
    document.cookie = name + "=" + escape(value) +
    ((expires != null) ? "; expires=" + expires.toGMTString() : "")
    + "; path=/";
    }
    function setName() {
    var expdate = new Date ();
    expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
    var prompt=i = document.Mail.name.value;
    setCookie("name", i, expdate);
    }
    function getName() {
    if(getCookie("name") != null) {
    document.Mail.Name.value = getCookie("emailname");
    }
    }
    function getInfo() {
    var now= new Date();
    document.Mail.Info.value = "Browser: " + navigator.userAgent;
    document.Mail.Info.value += "Date:" + now;
    }
    function checkMultiple() {
    if (getCookie("emailsent") == 'true') return true;
    else return false;
    }
    function process() {
    setCookie("emailsent", "true");
    with (document.Mail) {
    if (Subject.selectedIndex == 1) action = "mailto:antispammer@earthling.net?subject=TJS - Comment";
    else if (Subject.selectedIndex == 2) action = "mailto:antispammer@earthling.net?subject=TJS - Question";
    else if (Subject.selectedIndex == 3) action = "mailto:antispammer@earthling.net?subject=TJS - Suggestion";
    else if (Subject.selectedIndex == 4) action = "mailto:antispammer@earthling.net?subject=TJS - Broken Link";
    else action = "mailto:antispammer@earthling.net?subject=TJS - Other";
    }
    }
    function formCheck() {
    var passed = false;
    with (document.Mail) {
    if (Subject.selectedIndex == 0) {
    alert("Please pick a subject.");
    Subject.focus();
    }
    else if (Name.value == "") {
    alert("Please inlcude your name.");
    Name.focus();
    }
    else if (checkMultiple()) {
    if (confirm("You just sent an e-mail from this form, are you sure you want to send another?")) {
    process();
    passed = true;
    }
    }
    else {
    process();
    passed = true;
    }
    }
    return passed;
    }
    // End -->
    </script>


    </head>

    <body>


    </p><p align="center"> </p>

    <table class=normal WIDTH="96%" BORDER="0" CELLSPACING="5" CELLPADDING="5">
    <tr>
    <td WIDTH="100%">
    <p align="center"><font FACE="Times" SIZE="3"> </font></p>
    <font
    FACE="ARIEL,HELVETICA" SIZE="-1"></font>
    <form NAME="Mail" ACTION="mailto:antispammer@earthling.net?subject=T JS - Form"
    METHOD="POST" ENCTYPE="text/plain" onSubmit="return formCheck();">
    <font face="ARIEL,HELVETICA" size="-1">
    <input type="hidden" name="Info" value>
    </font>
    <table class=normal BORDER="0" CELLPADDING="10" CELLSPACING="0">
    <tr>
    <td>Name:
    <input TYPE="text" NAME="Name" onChange="setName()" size="20">
    </td>
    <td ALIGN="RIGHT">Subject:
    <select NAME="Subject" size="1">
    <option SELECT>Please Select A Subject</option>
    <option>1. Comment</option>
    <option>2. Question</option>
    <option>3. Suggestion</option>
    <option>4. Broken Link</option>
    <option>5. None of the above</option>
    </select>
    </td>
    </tr>
    <tr>
    <td COLSPAN="2">

    <textarea NAME="Comments, Suggestions" COLS="50" ROWS="6">
    </textarea>
    </td>
    </tr>
    </table>


    </p>
    <div align="center">
    <center>
    <table class=normal ><font
    FACE="ARIEL,HELVETICA" SIZE="-1"><font FACE="Times" SIZE="3">
    <tr>
    <td align="center"><input TYPE="submit" VALUE="Send"> <script LANGUAGE="JavaScript">
    <!-- Begin
    getInfo();
    getName();
    // End -->
    </script></td></tr></font></font>

    </table>
    </center></div>
    </form>
    </td>
    </tr>
    </table>
    </body>
    </html>

  2. #2
    Ammetto di non aver letto lo script, ma non ho capito cosa tu voglia fare dei dati una volta inseriti!

    Li vuoi mandare ad un'indirizzo di posta elettronica?
    Think global, act local.

  3. #3
    Utente di HTML.it L'avatar di hako
    Registrato dal
    Mar 2002
    Messaggi
    991
    Ciao vannicv!
    hai solo 4 messaggi e già ci siamo imbattuti 2 volte! :D .

    Quello che vuoi fare penso sia questo:

    <html>

    <head>
    <meta http-equiv="Content-Language" content="it">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Form Mail</title>
    </head>

    <body>

    <form method="POST" ENCTYPE="text/plain" action = "mailto:tuo_indirizzo@Tuo_Provider.com?subject=Mai l dal sito">



    Nome <input type="text" name="nome" size="20"></p>


    Città <input type="text" name="citta" size="20"></p>


    Via <input type="text" name="via" size="20"></p>


    Tel. <input type="text" name="tel" size="20"></p>


    Fax <input type="text" name="fax" size="20"></p>


    Commenti:</p>


    <textarea rows="2" name="commenti" cols="21"></textarea></p>


    <input type="submit" value="Invia" name="tasto1">
    <input type="reset" value="Reimposta" name="tasto2"></p>
    </form>


    </p>


    </p>

    </body>

    </html>


    naturalmente, cambia l'indirizzo e-mail con il tuo.
    Ciao
    cosa accaderebbe domani?

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.