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

    Script che divide un testo in 2 colonne

    Ho preparato uno script pre dividere un testo in due colonne, con una casellina per controllare la divisione, in modo da aggiustarsi un po' la formattazione.
    Pare che funzioni benino, ho anche messo un controllo sugli accapo, in modo che a destra non riparta con una riga vuota, e robe così.

    Vi incollo il codice, se vi interessa. Sarebbe bello anche implementare un sistema di percentuale di testo tra una colonna e un'altra.

    codice:
    <html>
    
    <head>
    <meta http-equiv="Content-Language" content="it">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    </head>
    
    <body>
    <% corpo = trim(request.form("txtCorpo"))
    
    Parole = request.form("cmbParole")
    
    if corpo<>"" then
    	corpo=replace(corpo, vbCrlf, "
     ")
    	corpo = replace(corpo, "  ", " ")
    	ArrCorpo = Split(corpo, " ")
    	Meta = cInt((Ubound(ArrCorpo)+1)/2)
    
    	if (Meta+parole<0) then
    		parole=0
    	End if
    	if (meta-1+parole>Ubound(ArrCorpo)) then
    		parole=0
    	End if
    	For i=0 to Meta-1+cInt(Parole)
    		CorpoSx=CorpoSx & ArrCorpo(i) & " "
    	next
    	'CorpoSx=Replace(CorpoSx, "  ", " ")
    	CorpoSx=Replace(CorpoSx, "
     ", "
    ")
    	
    	CorpoSx=Trim(CorpoSx)	
    
    	For i=meta+cInt(parole) to Ubound(ArrCorpo)
    		CorpoDx=CorpoDx & ArrCorpo(i) & " "
    	next
    	'CorpoDx=Replace(CorpoDx, "  ", " ")		
    	CorpoDx=Replace(CorpoDx, "
     ", "
    ")	
    	CorpoDx=trim(corpoDx)
    	if Left(CorpoDx, 4)= "
    " then
    		CorpoDx = Replace(corpodx, "
    ","", 1,1)
    	End if
    
    	CorpoDx=Trim(CorpoDx)		
    End if
    
    %>
    
    
    
    
    <div align="center">
      <center>
      <table border="0" width="50%" style="font-family: Arial; font-size: 9pt" cellspacing="6" cellpadding="3">
        <tr>
          <td width="100%" valign="top" colspan="2" style="font-size: 10pt">
          <% = request.form("txtTitolo") %>
          </td>
        </tr>
        <tr>
          <td width="50%" valign="top"><p align="justify"><% = CorpoSx %></p></td>
          <td width="50%" valign="top"><p align="justify"><% = CorpoDx %></p></td>
        </tr>
      </table>
    
    
    </p>
      <form method="POST" action="default.asp">  
      <table border="0" width="50%">
        <tr>
          <td colspan="2" align="center"><input type="submit" value="Invia" name="B1"></td>
        </tr>
        <tr>
          <td>Titolo
    
            <input type="text" name="txtTitolo" size="40" value="<% = request.form("txtTitolo") %>">
          </td>
          <td>Margine parole:
    
            <select size="1" name="cmbParole">
            <% For i=-20 to 20
            		if i>0 then i="+" & i 
            		
            		if i=0 and parole="" then
            			Sel = "SELECTED"
            		End if
            		if cInt(i)=cInt(parole) then
            			Sel= "SELECTED"
            		End if
            		%>
            <option value="<% = i %>" <% = Sel %>><% = i %></option>
            <% 
            		Sel=""
    	        next %>
            </select>
          </td>
        </tr>
        <tr>
          <td colspan="2">Corpo
    
            <textarea rows="10" name="txtCorpo" cols="52"><% = replace(Corpo, "
    ", vbCrlf) %></textarea>
            <p align="center"><input type="submit" value="Invia" name="B1"></p>
          </td>
        </tr>
      </table>
      </form>  
      </center>
    </div>
    </body>
    
    </html>

  2. #2
    ce la fai a mettere un esempio online che adesso non ho sottomano nulla per provarlo?

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.