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

    [classic ASP]toggle div su tabella

    ciao a tutti
    vorrei fare una cosa del genere ma non so se si può

    in asp

    dopo aver fatto una query ad un db
    escono i risultati su di una tabella
    vorrei che sotto ogni record risultante ci fosse un div con un iframe in cui far comparire un'immagine o un pdf
    questo div però vorrei poterlo aprire o chiudere a piacimento tramite un tasto posto alla fine di ogni record

    non so se mi sono spiegato

  2. #2
    Moderatore di Annunci siti web, Offro lavoro/collaborazione, Cerco lavoro L'avatar di cavicchiandrea
    Registrato dal
    Aug 2001
    Messaggi
    26,131
    Ma tu qui cosa chiedi:
    A) Processo inserimento iframe div ad ogni record?
    B) Processo apri/chiudi div?
    --------------------------------------------------------
    a) Posta la pagina che crea la tabella completa di connessione al database.
    b) Eseguibile in javascript posta la pagina (come la riceve il browser no codice asp) e fai spostare (link segnala ad un moderatore in basso a destra) dal moderatore di sezione la discussione nel forum javascript
    Cavicchi Andrea
    Problemi con javascript, jquery, ajax clicca qui

  3. #3
    allora il codice creazione tabella di inserimento con <div><iframe> è questo,
    premendo il pulsante "W" richiamo la funzione javascript ToggleDiv che dovrebbe
    far aprire-chiudere i div...

    codice:
     response.write "   <table width=910 cellspacing=0 cellpadding=0>" & VbCrLf
       response.write "      <tr>" & VbCrLf
       response.write "         <td class='LM'></td>" & VbCrLf
       response.write "         <td width=855>" & VbCrLf
       response.write "            <table>" & VbCrLf
       response.write "               <tr>" & VbCrLf
       response.write "                  <td width=5></td>" & VbCrLf
       response.write "                  <td>" & VbCrLf
       response.write "                     <input class='campo8' value='" & tCCP & "' readonly" & BackCol & " tabindex=-1 style='width:120'>" & VbCrLf
       response.write "                     <input class='campo7' value='" & tCAP & "' readonly" & BackCol & " tabindex=-1 style='width:80'>" & VbCrLf
       response.write "                     <input class='campo9' value='" & tIMP & "' readonly" & BackCol & " tabindex=-1 style='width:136'>" & VbCrLf
       response.write "                     <input class='campo7' value='" & tCaus & "' readonly" & BackCol & " tabindex=-1 style='width:220'>" & VbCrLf
       response.write "                     <input class='campo7' value='" & tVERS & "' readonly" & BackCol & " tabindex=-1 style='width:220'>" & VbCrLf
       response.write "                     <input type='button' class='menu' onclick='ToggleDiv()' value='W'/>"      
    '  stringa per aprire i PDF con frame al volo
       response.write "<div id='div1'>"
       response.write "<iframe src=""BOLL/" & tIMG & ".pdf"" width=""600"" height=""300""></iframe>"
       response.write "</div>"
       response.write "                  </td>" & VbCrLf
       response.write "                  <td width=5></td>" & VbCrLf
       response.write "               </tr>" & VbCrLf
       response.write "            </table>" & VbCrLf
       response.write "         </td>" & VbCrLf
       response.write "         <td class='RM'></td>" & VbCrLf
       response.write "      </tr>" & VbCrLf
       response.write "   </table>" & VbCrLf
    togglediv è una sempilcissima funzione jquery


    codice:
    <script type="text/javascript"> $(document).ready(function(){ $("#div1").hide(); }); Function ToggleDiv(){ $("#div1").slideToggle(700); } </script>
    (che segnalerò sulla sezione javascript)

    penso che per farlo funzionare io debba creare qualcosa per cui i vari div abbiano un nome differente, sennò come fa la funzione a sapere quale div deve aprire

  4. #4
    Moderatore di Annunci siti web, Offro lavoro/collaborazione, Cerco lavoro L'avatar di cavicchiandrea
    Registrato dal
    Aug 2001
    Messaggi
    26,131
    codice:
    response.write "   <table width=910 cellspacing=0 cellpadding=0>" & VbCrLf
       response.write "      <tr>" & VbCrLf
       response.write "         <td class='LM'></td>" & VbCrLf
       response.write "         <td width=855>" & VbCrLf
       response.write "            <table>" & VbCrLf
       response.write "               <tr>" & VbCrLf
       response.write "                  <td width=5></td>" & VbCrLf
       response.write "                  <td>" & VbCrLf
       response.write "                     <input class='campo8' value='" & tCCP & "' readonly" & BackCol & " tabindex=-1 style='width:120'>" & VbCrLf
       response.write "                     <input class='campo7' value='" & tCAP & "' readonly" & BackCol & " tabindex=-1 style='width:80'>" & VbCrLf
       response.write "                     <input class='campo9' value='" & tIMP & "' readonly" & BackCol & " tabindex=-1 style='width:136'>" & VbCrLf
       response.write "                     <input class='campo7' value='" & tCaus & "' readonly" & BackCol & " tabindex=-1 style='width:220'>" & VbCrLf
       response.write "                     <input class='campo7' value='" & tVERS & "' readonly" & BackCol & " tabindex=-1 style='width:220'>" & VbCrLf
       response.write "                     <input type=""button"" class=""menu"" onclick=""ToggleDiv('div_"&record("id")&"')"" value=""W"/>"      
    '  stringa per aprire i PDF con frame al volo
       response.write "<div id=""div_"&record("id")&""" class=""div_pdf"" >"
       response.write "<iframe src=""BOLL/" & tIMG & ".pdf"" width=""600"" height=""300""></iframe>"
       response.write "</div>"
       response.write "                  </td>" & VbCrLf
       response.write "                  <td width=5></td>" & VbCrLf
       response.write "               </tr>" & VbCrLf
       response.write "            </table>" & VbCrLf
       response.write "         </td>" & VbCrLf
       response.write "         <td class='RM'></td>" & VbCrLf
       response.write "      </tr>" & VbCrLf
       response.write "   </table>" & VbCrLf
    record = id della tabella per avere un dato univoco.
    Meglio non usare l'apice ' come delimitatore meglio raddoppiate le virgolette "" sintassi corretta per asp.
    Visto che forzi il display non con jquery (che comunque andrebbe rivisto per eseguirlo su tutti i div della tabella) ho optato per una soluzione css.
    nella head:
    codice:
    <style type="text/css">
    .div_pdf {
    	display: none;
    }
    </style>
    
    <script type="text/javascript"> 
    function ToggleDiv(IDiv){
    $("#"+IDiv).slideToggle(700); 
    } 
    </script>
    Chiaramente questo soluzione non aprirà/chiuderà i div simultaneamente (div1 aperto clicco su div2 apre div2 e chiudo div1) ma gestirà i singoli div separatamente.


    P.S. Perché apri una nuova discussione identica?
    P.S.S. Quando nella risposta ci sono delle "richieste" cerca di soddisfarle (nel limite del possibile), è nel tuo interesse molti utenti si infastidiscono perché sembra che non li "ascolti".
    Cavicchi Andrea
    Problemi con javascript, jquery, ajax clicca qui

  5. #5
    intanto grazie del tuo aiuto ma cè qualcosa che non va perchè i div non si aprono/chiudono

    questo è l'input del primo record
    codice:
          <table>
              <tr>
                  <td width=5></td>
                      <td>
                         <input class='campo8' value='302901' readonly tabindex=-1 style='width:120'>
                         <input class='campo7' value='1730' readonly tabindex=-1 style='width:80'>
                         <input class='campo9' value='200,00' readonly tabindex=-1 style='width:136'>
                         <input class='campo7' value='DIRITTI FISSI EX ART. 37 L.R. 20/03' readonly tabindex=-1 style='width:220'>
                         <input class='campo7' value='DI STEFANO LEONARDO - VIA A. CALVARIO 56 - 90034 CORLEONE' readonly tabindex=-1 style='width:220'>
                     <input type='button' class='menu' onClick='ToggleDiv('div_1243')' value='W'/><div id="div_1243" class="div_pdf" ><iframe src="BOLL/0000011.pdf" width="600" height="300"></iframe><input type ='button' class=''menu' onclick = 'domw3c()' value='ciao'/ OnMo></div>                  </td>
                      <td width=5></td>
                   </tr>
                </table>
             </td>
             <td class='RM'></td>
          </tr>
       </table>
    ps pensavo che dalla domanda originale non si capisse il mio problema javascript
    pss porta pazienza ma ho cominciato con asp/html/javascript/css solo da un paio di settimane quindi non ci capisco ancora un ca°°@

  6. #6
    potrebbe essere che la funzione non va perchè cè qualche altro problema da qualche parte...
    ma non riesco a scoprirlo nonostante la potente IDE (debug di IE8)

  7. #7
    risolto

    grande cavicchiandrea

    grazie 1000

  8. #8
    ciao a tutti
    riprendo questo 3d perchè vorrei sapere se è possibile fare una cosa

    io ho un iframe che viene caricato assieme ad un popolamento di una tabella.
    su questo iframe carico un file pdf
    ora questo file pdf non ce l'ho più come singolo file ma in un failone binario di cui ho il puntamento.
    è possibile in javascript fare ciò???


    codice:
       response.write "   <table width=910 cellspacing=0 cellpadding=0>" & VbCrLf
       response.write "      <tr>" & VbCrLf
       response.write "         <td class='LM'></td>" & VbCrLf
       response.write "         <td width=855>" & VbCrLf
       response.write "            <table>" & VbCrLf
       response.write "               <tr>" & VbCrLf
       response.write "                  <td width=5></td>" & VbCrLf
       response.write "                  <td>" & VbCrLf
       response.write "                     <input class='campo8' value='" & tCCP & "' readonly" & BackCol & " tabindex=-1 style='width:120'>" & VbCrLf
       response.write "                     <input class='campo7' value='" & tCAP & "' readonly" & BackCol & " tabindex=-1 style='width:80'>" & VbCrLf
       response.write "                     <input class='campo9' value='" & tIMP & "' readonly" & BackCol & " tabindex=-1 style='width:136'>" & VbCrLf
       response.write "                     <input class='campo7' value='" & tCaus & "' readonly" & BackCol & " tabindex=-1 style='width:220'>" & VbCrLf
       response.write "                     <input class='campo7' value='" & tVERS & "' readonly" & BackCol & " tabindex=-1 style='width:220'>" & VbCrLf
       response.write "                     <input type=""button"" class=""menu"" onclick=""ToggleDiv('div_"&record("id")&"')"" value=""W"/>"      
    '  stringa per aprire i PDF con frame al volo
       response.write "<div id=""div_"&record("id")&""" class=""div_pdf"" >"
       response.write "<iframe src=""BOLL/" & tPdf & ".pdf""   width=""600"" height=""300""></iframe>"
       response.write "</div>"
       response.write "                  </td>" & VbCrLf
       response.write "                  <td width=5></td>" & VbCrLf
       response.write "               </tr>" & VbCrLf
       response.write "            </table>" & VbCrLf
       response.write "         </td>" & VbCrLf
       response.write "         <td class='RM'></td>" & VbCrLf
       response.write "      </tr>" & VbCrLf
       response.write "   </table>" & VbCrLf

  9. #9
    Moderatore di Annunci siti web, Offro lavoro/collaborazione, Cerco lavoro L'avatar di cavicchiandrea
    Registrato dal
    Aug 2001
    Messaggi
    26,131
    Dubito si possa fare qualcosa, ma forse traducendo ma in un failone binario di cui ho il puntamento, sopratutto si dovrebbe capire cosa?
    Cavicchi Andrea
    Problemi con javascript, jquery, ajax clicca qui

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 © 2024 vBulletin Solutions, Inc. All rights reserved.