Visualizzazione dei risultati da 1 a 6 su 6

Discussione: Contatore

  1. #1
    Utente di HTML.it
    Registrato dal
    May 2001
    Messaggi
    143

    Contatore

    Buonasera ragazzi ho un problema con uno script:

    devo inserire un campo contatore all'interno di un for che si aggiorna ad ogni invio di email lo script che ho usato e' il seguente:

    <table width="740" border="0" cellspacing="0" cellpadding="0" align="center" height="598">
    <tr>
    <td colspan="3" bgcolor="#000000" height="1"><img src=images/spaziatore.gif" width="1" height="1"></td>
    </tr>
    <tr>
    <td width="1" bgcolor="#000000" height="150"><img src=images/spaziatore.gif" width="1" height="1"></td>
    <td bgcolor="#FFFFFF" height="150">[img]images/logo.gif[/img]</td>
    <td width="1" bgcolor="#000000" height="150"><img src=images/spaziatore.gif" width="1" height="1"></td>
    </tr>
    <tr>
    <td width="1" bgcolor="#000000" height="426"><img src=images/spaziatore.gif" width="1" height="1"></td>
    <td bgcolor="#FFFFFF" height="426">
    <script language="JavaScript">
    <!--
    function Counter(INVIO){

    cont = 747
    if(INVIO.NoEm.value!=0)cont--
    {
    Disp = maxNoEm - INVIO.NoEm.value.cont;
    }
    else
    {
    Disp = 0;
    }
    INVIO.contatoreNoEm.value = Disp;
    }

    maxNoEm = 747;
    //-->
    </script>
    <form action="#" method="post" name="INVIO">
    <table align="center" cellpadding="0" cellspacing="0" border="0">
    <tr>
    <td align="center" class="titolo" colspan="3">Invio e-mail</td>
    </tr>
    <tr>
    <td align="center" colspan="3"><img src=images/spaziatore.gif" width="1" height="20"></td>
    </tr>
    <tr>
    <td class="titolo">Contatore</td>
    <td><img src=images/spaziatore.gif" width="10" height="1"></td>
    <td>
    <input type="hidden" name="NoEm" onkeyup=Counter(document.INVIO) value="10">

    <input type="hidden" name="NoEm" onkeyup=Counter(document.INVIO) value="9">

    <input type="hidden" name="NoEm" onkeyup=Counter(document.INVIO) value="8">

    <input type="hidden" name="NoEm" onkeyup=Counter(document.INVIO) value="7">

    <input type="hidden" name="NoEm" onkeyup=Counter(document.INVIO) value="6">

    <input type="hidden" name="NoEm" onkeyup=Counter(document.INVIO) value="5">

    <input type="hidden" name="NoEm" onkeyup=Counter(document.INVIO) value="4">

    <input type="hidden" name="NoEm" onkeyup=Counter(document.INVIO) value="3">

    <input type="hidden" name="NoEm" onkeyup=Counter(document.INVIO) value="2">

    <input type="hidden" name="NoEm" onkeyup=Counter(document.INVIO) value="1">

    <input name="contatoreNoEm" size="3" value="0" disabled>
    </td>
    </tr>
    </table>
    </form>
    </td>
    <td width="1" bgcolor="#000000" height="426"><img src=images/spaziatore.gif" width="1" height="1"></td>
    </tr>
    <tr>
    <td width="1" bgcolor="#000000" height="20"><img src=images/spaziatore.gif" width="1" height="1"></td>
    <td bgcolor="#FFFFFF" height="20" align="center"></td>
    <td width="1" bgcolor="#000000" height="20"><img src=images/spaziatore.gif" width="1" height="1"></td>
    </tr>
    <tr>
    <td colspan="3" bgcolor="#000000" height="1"><img src=images/spazio.gif" width="1" height="1"></td>
    </tr>
    </table>

    1000 grazie a chi mi possa dare una mano.
    Gennaro

  2. #2
    Utente di HTML.it
    Registrato dal
    May 2001
    Messaggi
    143
    Ragazzi una mano perfavore
    Gennaro

  3. #3
    Moderatore di JavaScript L'avatar di br1
    Registrato dal
    Jul 1999
    Messaggi
    19,998
    Non ho capito quando gli script vengano invocati... ma ho notato un errore:

    cont = 747
    if(INVIO.NoEm.value!=0) cont--
    {
    Disp = maxNoEm - INVIO.NoEm.value.cont;

    ciao

    ps: come fai a scatenare l'evento onkeyup in un campo nascosto? :master:

    <input type="hidden" name="NoEm" onkeyup=Counter(document.INVIO) ...>
    Il guaio per i poveri computers e' che sono gli uomini a comandarli.

    Attenzione ai titoli delle discussioni: (ri)leggete il regolamento
    Consultate la discussione in rilievo: script / discussioni utili
    Usate la funzione di Ricerca del Forum

  4. #4
    Utente di HTML.it
    Registrato dal
    May 2001
    Messaggi
    143
    infatti e' questo il mio problema come far partire l'evento

    tu come faresti??

    grazie per il tuo interessamento
    Gennaro

  5. #5
    Utente di HTML.it
    Registrato dal
    May 2001
    Messaggi
    143
    Buongiorno ragazzi sono ancora per questo script ho provato a modificarlo direi a rifarlo:

    <script language="JavaScript">
    <!--
    function conta(valore)
    {
    document.INVIO.visualizza.value = valore;
    //alert(document.INVIO.visualizza.value)
    }

    function valiCount(valore)
    {
    this.valore = valore
    this.numero = conta(valore)
    }
    //-->
    </script>
    <form action="#" method="post" name="INVIO">
    <table align="center" cellpadding="0" cellspacing="0" border="0">
    <tr>
    <td align="center" class="titolo" colspan="3">Invio e-mail</td>
    </tr>
    <tr>
    <td align="center" colspan="3"><img src=images/spaziatore.gif" width="1" height="20"></td>
    </tr>
    <tr>
    <td class="titolo">Contatore</td>
    <td><img src=images/spaziatore.gif" width="10" height="1"></td>
    <td><input name="visualizza" size="3" disabled></td>
    </tr>
    </table>
    </form>
    <%Dim SQLTESTO, RSTESTO, strMessaggio, SQLMITTENTE, RSMITTENTE, strMittente, strOggetto, strFirma, strStile
    SQLTESTO = "SELECT * FROM PARAMETRI"
    Set RSTESTO = Conn.Execute(SQLTESTO)
    strMessaggio = RSTESTO("Email")
    strMittente = RSTESTO("IDEmail")
    SQLMITTENTE = "SELECT * FROM EMAIL WHERE IDEmail=" & strMittente
    Set RSMITTENTE = Conn.Execute(SQLMITTENTE)
    strMittente = RSMITTENTE("Indirizzo")
    RSMITTENTE.Close
    Set RSMITTENTE = nothing
    strOggetto = RSTESTO("Oggetto")
    strFirma = RSTESTO("Firma")
    strStile = RSTESTO("Stile")
    RSTESTO.Close
    Set RSTESTO = nothing

    Dim strcampo, strselezione
    If Request.Form("selezione") = "tutti" Then
    strselezione=Request.Form("selezione")
    SQLINVIO = "SELECT * FROM News WHERE News.disabilitato=True And News.invio=False And News.Email<>'';"
    Else
    strcampo="IDCATEGORIA"
    strselezione=Request.Form("selezione")
    SQLINVIO = "SELECT * FROM News WHERE News.disabilitato=True And News.invio=False And News.Email<>'' And " & strcampo & " = " & strselezione
    End if
    Dim SQLINVIO, RSINVIO, iCount, i
    Set RSINVIO = Server.CreateObject("ADODB.RECORDSET")
    RSINVIO.Open SQLINVIO, Conn, 3, 3
    iCount = RSINVIO.RecordCount 'Conteggia e-mail da inviare
    Dim Utente, EmailUt, strOrgMessaggi, strExMessaggi, strNewMessaggi, NewStrMessaggi, strBody
    Do While Not RSINVIO.EOF
    Utente = RSINVIO("IDNEWS")
    EmailUt = RSINVIO("Email")

    strOrgMessaggi = strMessaggio
    strExMessaggi = "|*|"
    strNewMessaggi = "&IDUt="& Utente & "&Email=" & EmailUt
    NewStrMessaggi = replace(strOrgMessaggi,strExMessaggi,strNewMessagg i)
    strBody = "<Html><Head><link rel=stylesheet href='" & strStile & "' type='text/css'></Head><Body><center>" & NewStrMessaggi & "</center></Body></Html>"
    Dim Mittente, Destinatario, Titolo, Livello, Corpo
    Mittente = strFirma & "<" & strMittente & ">"
    Destinatario = EmailUt
    Titolo = strOggetto
    Livello = 2
    Corpo = strBody
    'InvioMail Mittente, Destinatario, Titolo, Livello, Corpo
    Dim SQLMODINVIO, rsMODCAT
    SQLMODINVIO = "UPDATE News SET "
    SQLMODINVIO = SQLMODINVIO & " invio=True"
    SQLMODINVIO = SQLMODINVIO & " Where IDNEWS=" & Utente
    Set rsMODCAT=Conn.Execute(SQLMODINVIO)
    iCount=iCount-1%>
    <SCRIPT LANGUAGE=JavaScript>
    <!--
    contatore = new valiCount("<%=iCount%>")
    contatore.numero
    //-->
    </SCRIPT>
    <%RSINVIO.MoveNext
    Loop
    RSINVIO.Close
    Set RSINVIO = Nothing
    Conn.Close
    Set Conn = nothing%>

    lo script adesso non da errori ma riesco a visualizzare il contatore a video solo alla fine del ciclo asp ho inserito un alert che adesso e' remmato e va perfettamente perchè non riesco a vedere la pagina ed il contatore esplicare le sue funzioni.

    Ragazzi perfavore una mano 1000 grazie.
    Gennaro

  6. #6
    Utente di HTML.it
    Registrato dal
    May 2001
    Messaggi
    143
    Ragazzi una mano perfavore
    Gennaro

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.