Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 13
  1. #1
    Utente di HTML.it
    Registrato dal
    Nov 2001
    Messaggi
    184

    Una variabile da inserire nell'istruzione document!

    Allora ho una funzione + o - così :

    function Fnt(valore1, valore2, obbli, nomecampo, nomeform){
    if (obbli == 1) && (valore2 == ''){
    alert('Errore');
    document.nomeform.nomecampo.focus();
    }
    }

    Chiaramente essendo nomecampo e nomeform variabili va in errore, come posso evitare questo errore?

  2. #2
    non capisco ma...?

    document.forms[nomeform].elements[nomecampo].focus( );


    ???
    DYNAMIC+ [ E-mail ]

    Secondo me non si può fare!

  3. #3
    Utente di HTML.it
    Registrato dal
    Nov 2001
    Messaggi
    184

    Ma?

    In che senso non capisco.
    Al posto di creare una funzione per ogni campo, ne creo una dinamica.
    Verifico nuova soluzione e riposto.....

  4. #4

    Re: Ma?

    Originariamente inviato da kekkosf
    In che senso non capisco.
    Al posto di creare una funzione per ogni campo, ne creo una dinamica.
    Verifico nuova soluzione e riposto.....

    sisi... ho capito...
    hai provato a mettere quello sopra al posto di
    document.nomeform.nomecampo.focus();

    ?
    DYNAMIC+ [ E-mail ]

    Secondo me non si può fare!

  5. #5
    Utente di HTML.it
    Registrato dal
    Nov 2001
    Messaggi
    184

    Non funge ancora......

    Posto funzione:

    function PopUPFinte(pagina,valore,variabile, obbli, nomecampo){
    if ((obbli == 'S') && (valore == ''))
    {
    alert('Campo Obbligatorio');
    documents.forms[Testata].elements[nomecampo].focus();
    }
    if (valore != '')
    {
    lt = screen.width;
    tp = screen.height;
    window.open( pagina+'?'+variabile+'='+valore+'&CodDit=$CodDit&D BNAME=$DBNAME', 'miaPop', 'scrollbars=no, titlebar=no, menubar=no, status=no , resizable=no, width=1, height=1, left=lt;, top=tp');
    }
    }

  6. #6
    ma Testata che variabile è? è il NOME del form?ù
    se si va tra VIRGOLETTE!
    DYNAMIC+ [ E-mail ]

    Secondo me non si può fare!

  7. #7
    Utente di HTML.it
    Registrato dal
    Nov 2001
    Messaggi
    184

    non funziona ancora .....

    function PopUPFinte(pagina,valore,variabile, obbli, nomecampo, Testata){
    if ((obbli == 'S') && (valore == ''))
    {
    alert('Campo Obbligatorio');
    documents.forms[Testata].elements[nomecampo].focus();
    }
    if (valore != '')
    {
    lt = screen.width;
    tp = screen.height;
    window.open( pagina+'?'+variabile+'='+valore+'&CodDit=$CodDit&D BNAME=$DBNAME', 'miaPop', 'scrollbars=no, titlebar=no, menubar=no, status=no , resizable=no, width=1, height=1, left=lt;, top=tp');
    }
    }


    Testata o nomeform è lo stesso.
    Sono stringhe le variabili se puà essere d'aiuto.
    Grazie mille cmq dynamic+, indipendentemente da come va a finire....

    Se hai bisgno di PHP o MySql a tua disposizione!

  8. #8
    facciamo cosi...

    riporta tutta la pagina o il link...
    dove usi questa funzione...
    DYNAMIC+ [ E-mail ]

    Secondo me non si può fare!

  9. #9
    ps...

    documents.forms[Testata].elements[nomecampo].focus();

    non è DOCUMENTS ma senza la ESSE (minuscolo)
    DYNAMIC+ [ E-mail ]

    Secondo me non si può fare!

  10. #10
    Utente di HTML.it
    Registrato dal
    Nov 2001
    Messaggi
    184

    La pagina non è online, ecco l'HTML generato

    <html>
    <head>
    <title>.: PrimaNota OnLine by Initweb :.</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script language="JavaScript">

    function WinPers(url,name,w,h)
    {
    lt = (screen.width - w)/2;
    tp = (screen.height - h)/2 - 50;

    popupWin = window.open(url,name,'left='+lt+', top='+tp+', scrollbars=yes, titlebar=yes, menubar=yes, status=yes , resizable=yes, width='+w+',height='+h)
    }

    function onlynum(e)
    {
    if(e.which){
    if(e.which!=46 && e.which!=8 && (e.which<48 || e.which>57))
    return false;
    }
    else if(e.keyCode){
    if(e.keyCode!=46 && e.keyCode!=8 && (e.keyCode<48 || e.keyCode>57))
    return false;
    }
    return true;
    }


    function PopUP(pagina,valore,variabile)

    {

    if (valore != '')

    {

    window.open( pagina+'?'+variabile+'='+valore+'&CodDit=0001&DBNA ME=PrimaNota', 'miaPop', 'scrollbars=yes, titlebar=yes, menubar=yes, status=yes , resizable=yes, width=400, height=300');

    }

    }


    function PopUPFinte(pagina,valore,variabile, obbli, nomecampo, nomeform)

    {

    if ((obbli == 'S') && (valore == ''))
    {
    alert('Campo Obbligatorio');
    documents.forms[nomeform].elements[nomecampo].focus();
    }

    if (valore != '')

    {

    lt = screen.width;
    tp = screen.height;
    window.open( pagina+'?'+variabile+'='+valore+'&CodDit=0001&DBNA ME=PrimaNota', 'miaPop', 'scrollbars=no, titlebar=no, menubar=no, status=no , resizable=no, width=1, height=1, left=lt;, top=tp');

    }

    }


    var isNav=false
    if (parseInt(navigator.appVersion)>=4){
    if (navigator.appName == "Netscape"){
    window.captureEvents(Event.ONKEYPRESS)
    window.onkeypress = tasti
    isNav = true
    }
    else
    document.onkeydown = tasti
    }

    var pos=null
    var variabili=null

    function tasti(e){
    nome = pos;
    if (nome != null){
    if (isNav){
    if (e.keyCode == 120){
    WinPers(nome+'.php?Form=Testata&DBNAME=PrimaNota&C l=cl_kekko'+variabili,'new_win',625,375)
    }
    }
    else{
    if (window.event.keyCode == 120){
    WinPers(nome+'.php?Form=Testata&DBNAME=PrimaNota&C l=cl_kekko'+variabili,'new_win',625,375)
    }
    }
    pos = null;
    }
    }

    function ControlloAnno(Valore,ValChk){
    if (ValChk != Valore){
    Flag = confirm('Data di registrazione non compresa nel periodo contabile !!!\r\nConferma?');
    if (Flag!=true){
    document.Testata.AaDatReg.value=ValChk;
    }
    }
    else
    {
    if (document.Testata.AaDatDoc.value.length == 0){
    document.Testata.AaDatDoc.value = document.Testata.AaDatReg.value;
    }
    if (document.Testata.MmDatDoc.value.length == 0){
    document.Testata.MmDatDoc.value = document.Testata.MmDatReg.value;
    }
    if (document.Testata.GgDatDoc.value.length == 0){
    document.Testata.GgDatDoc.value = document.Testata.GgDatReg.value;
    }
    }
    }

    function ControlloDoc(AA, MM, GG, Anno){
    DataDoc = AA+MM+GG;
    DataReg = document.Testata.AaDatReg.value+document.Testata.M mDatReg.value+document.Testata.GgDatReg.value

    if (DataDoc > DataReg){
    alert('Data documento superiore a quella di registrazione !!!');
    document.Testata.AaDatDoc.value = document.Testata.AaDatReg.value;
    document.Testata.MmDatDoc.value = document.Testata.MmDatReg.value;
    document.Testata.GgDatDoc.value = document.Testata.GgDatReg.value;
    document.Testata.GgDatDoc.focus();
    }

    if (Anno != AA){
    Flag = confirm('Data documento non compresa nel periodo contabile !!!\r\nConferma?');
    if (Flag!=true){
    document.Testata.AaDatDoc.value=Anno;
    }
    }


    }
    </script>
    </script>
    <style>
    body {font-family:verdana; font-size: 12pt; background-color: #D0D0D0; }
    hr {color:#FF9900}
    td {font-family:verdana; font-size: 10pt}
    input {font-family:verdana; font-size: 10pt}
    </style>
    </head>

    <body OnLoad="document.Testata.codcaus.focus()">
    <table align = "center" width = "100%">
    <tr>
    <td valign="top">
    [img]img/home.png[/img]
    </td>
    <td colspan="3" align="right">
    [img]img/logo_pn.png[/img]
    </td>
    </tr>
    <tr>
    <td colspan="4" valign="top">
    <hr>
    </td>
    </tr></TABLE>

    <FORM ACTION="testata.php" METHOD="POST" NAME="Testata">
    <TABLE WIDTH="95%" ALIGN="center">

    <TR>

    <TD align = "right">

    Causale :

    </TD>

    <TD>

    <INPUT TYPE="Text" NAME="codcaus" MAXLENGTH="3" SIZE="3" VALUE = "" onfocus = "pos=this.name;" onBlur="PopUPFinte('descau.php',this.value,'CodCau s','S','codcaus');">
    <INPUT TYPE="Text" NAME="descaus" MAXLENGTH="40" SIZE="42">
    </TD>

    </TR>

    <TR>

    <TD align = "right">

    Data registrazione :

    </TD>

    <TD>

    <INPUT TYPE="Text" NAME="GgDatReg" MAXLENGTH="2" SIZE="2" VALUE="01" onKeyPress="return onlynum(event)">
    <INPUT TYPE="Text" NAME="MmDatReg" MAXLENGTH="2" SIZE="2" VALUE="01" onKeyPress="return onlynum(event)">
    <INPUT TYPE="Text" NAME="AaDatReg" MAXLENGTH="4" SIZE="4" VALUE="2004" onKeyPress="return onlynum(event)" OnBlur="ControlloAnno(this.value, '2004')">
    </TD>

    </TR>

    <TR>

    <TD align = "right">

    Data documento :

    </TD>

    <TD>

    <INPUT TYPE="Text" NAME="GgDatDoc" MAXLENGTH="2" SIZE="2" VALUE="" onKeyPress="return onlynum(event)">
    <INPUT TYPE="Text" NAME="MmDatDoc" MAXLENGTH="2" SIZE="2" VALUE="" onKeyPress="return onlynum(event)">
    <INPUT TYPE="Text" NAME="AaDatDoc" MAXLENGTH="4" SIZE="4" VALUE="" onKeyPress="return onlynum(event)" OnBlur="ControlloDoc(this.value, MmDatDoc.value, GgDatDoc.value, '2004')">
    </TD>

    </TR>

    <TR>

    <TD align="right">
    Num. doc. originale :

    </TD>
    <TD>

    <INPUT TYPE="Text" NAME="NumDoc" MAXLENGTH="30" SIZE="10" VALUE="">

    Nr. serie/protocollo :
    <INPUT TYPE="Text" NAME="codserie" MAXLENGTH="2" SIZE="2" VALUE="" onKeyPress="return onlynum(event)" onfocus = "pos=this.name;variabili='&CodDit=0001&Anno=2004&C odAtt=01413'" onBlur="PopUPFinte('desserie.php',this.value,'CodD it=0001&Anno=2004&CodAtt=01413&CodCaus='+document. Testata.codcaus.value+'&Serie','S','codserie');">

    <INPUT TYPE="Text" NAME="Prot" MAXLENGTH="5" SIZE="5" VALUE="" onKeyPress="return onlynum(event)">
    </TD>

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.