ho recuperato questa vecchissima pagina: vedi se può servire
codice:<%@ Language=VBScript %> <% Option explicit 'ScriviParametri dim Righe, Colonne, Dati, CelleRimanenti, ColonneRimanenti, dati_max dim tmp_dati(), mat_dati() dim p_colonne, p_dati, p_verticale, p_orientamento dim i, j, n 'numero colonne p_colonne = trim(Request.Form("p_colonne")): if p_colonne = "" then p_colonne = 5 else p_colonne = cint(p_colonne) 'numero dati p_dati = trim(Request.Form("p_dati")): if p_dati = "" then p_dati = 6 else p_dati = cint(p_dati) 'orientamento: orizzontale-verticale p_orientamento = trim(Request.Form("p_orientamento")): if p_orientamento = "" then p_orientamento = "verticale" if (p_orientamento = "verticale") then dati = p_dati Colonne = p_colonne if Colonne > dati then colonne = dati Righe = ((dati - 1) \ Colonne) + 1 dati_max = Righe * Colonne CelleRimanenti = dati_max - Dati ColonneRimanenti = CelleRimanenti \ Righe If ColonneRimanenti > 0 Then Colonne = Colonne - ColonneRimanenti Righe = ((Dati - 1) \ Colonne) + 1 dati_max = Righe * Colonne CelleRimanenti = dati_max - Dati End If else 'orizzontale dati = p_dati Colonne = p_colonne if Colonne > dati then colonne = dati Righe = ((dati - 1) \ Colonne) + 1 dati_max = Righe * Colonne CelleRimanenti = dati_max - Dati end if 'dati di prova redim tmp_dati(dati_max - 1) for i = 0 to dati - 1 tmp_dati(i) = i + 1 next for i = (dati ) to dati_max - 1 tmp_dati(i) = "" next 'matrice degli indici redim mat_dati(righe - 1, colonne - 1) n = -1 if (p_orientamento = "verticale") then for j = 0 to colonne - 1 for i = 0 to righe - 1 n = n + 1 mat_dati(i, j) = n next next else for i = 0 to righe - 1 for j = 0 to colonne - 1 n = n + 1 mat_dati(i, j) = n next next end if %> <HTML> <HEAD> <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"> <LINK rel="stylesheet" type="text/css" href="/archivioesempi/Stile.css"> <STYLE TYPE="text/css" MEDIA=ALL> TABLE { border-collapse: separate; } </STYLE> <STYLE TYPE="text/css" MEDIA=SCREEN></STYLE> <STYLE TYPE="text/css" MEDIA=PRINT></STYLE> <SCRIPT SRC="/archivioesempi/code.js"></SCRIPT> <SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript> <!-- function p_orientamento_onclick() { document.form1.submit(); } //--> </SCRIPT> </HEAD> <BODY> <h1>Elenco dati in colonne</h1> <form method=post id=form1 name=form1 > <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=1> <tr> <td><label for="p_orientamento1">Orizzontale: </label><INPUT type="radio" id=p_orientamento1 name=p_orientamento value="orizzontale" <%=checked(p_orientamento, "orizzontale")%> LANGUAGE=javascript onclick="return p_orientamento_onclick()"></td> <td><label for="p_orientamento2">Verticale: </label><INPUT type="radio" id=p_orientamento2 name=p_orientamento value="verticale" <%=checked(p_orientamento, "verticale")%> LANGUAGE=javascript onclick="return p_orientamento_onclick()"></td> </tr> <TR> <TD> NumeroColonne: </TD> <TD> <INPUT id=text1 name=p_colonne value=" <%=p_colonne%>"> </TD> </TR> <TR> <TD> Numero Dati: </TD> <TD> <INPUT id=text2 name=p_dati value=" <%=p_dati%>"> </TD> </TR> <TR> <TD colspan=2><INPUT id=submit1 type=submit value=Incolonna ></TD> </TR> </TABLE> </form> <HR> <table border=1 cellspacing=0 cellpadding=2> <tr> <th colspan="<%=Colonne%>">Numero</th> </tr> <% for i = 0 to Righe - 1%> <tr> <% for j = 0 to Colonne - 1 %> <td><%=tmp_dati(mat_dati(i,j))%></td> <% next %> </tr> <% next %> </table> </BODY> </HTML> <% '-------------------------------------------------------------- 'ristabilisce la selezione in un checkbox '-------------------------------------------------------------- function checked(firstVal, secondVal) if cstr(firstVal) = cstr(secondVal) then checked = " CHECKED " else checked = "" end if end function %>

Rispondi quotando