Moderatori: Anthony47, Triumph Of Steel, archimede
Ho creato una pagina di prova utilizando il codice, opportunamente modificato, del form della pagina di cui si sta discutendo.landyl ha scritto:non credo basti ricreare il codice della pagina, perchè come minimo si deve creare un form e altre pagine...
[... codice ...]
<FORM name="inviamsg" method="post" action="/insermessaggio.asp">
<p align=justify>
<font size=2>
<b>Scrivi un tuo messaggio!!!</b><br>Lo vedrai comparire nel testo scorrevole che vedi in alto!<br><br>
</font>
</p>
<TABLE CELLPADDING=0 CELLSPACING=0 align=center border=0>
<TR>
<td width=70 align=right><b>Nome:</b></td>
<td width=130>
<input type="text" name="nick" size="15" maxlength="15" value="">
<INPUT type="hidden" name="send" value="yes">
</td>
</TR>
<TR>
<td align=center width=70>
<b>Messaggio:</b><br><br><br><font size="1"><b>Caratteri<br>disponibili</b></font><br><br>
<input type="text" readonly name="charsleft" size="3" value="100"><br><br>
<input type="submit" value="Invia" name="invia">
</td>
<td width=130>
<textarea name="testo" rows="11" cols="12" OnKeyUp="calcCharLeft()" OnChange="calcCharLeft()"></textarea>
</td>
</TR>
</table>
</form>
[... codice ...]
<%
if request("nick")="" or request("testo")="" then
response.redirect "/"
end if
DIM MESSAGGIO(5)
Set Fil=CreateObject("Scripting.FileSystemObject")
Set inf=Fil.OpenTextFile("PERCORSODELFILE\NOMEDELFILE.TXT",1,true)
for t=1 to 5
if inf.AtEndofStream then exit for
MESSAGGIO(t)=inf.ReadLine()
next
for t=4 to 1 step -1
MESSAGGIO(t+1)=MESSAGGIO(t)
next
nick = replace(replace(replace(replace(request("nick"),vbcrlf," "),chr(10)," "),chr(13)," "),"<","<")
testo = replace(replace(replace(replace(request("testo"),vbcrlf," "),chr(10)," "),chr(13)," "),"<","<")
MESSAGGIO(1)= right("0" & day(now),2) & "/" & right("0" & month(now),2) & "/" & year(now) & " h. " & right("0" & hour(now),2) & ":" & right("0" & minute(now),2) & ":" & right("0" & second(now),2) & " [" & nick & "]: " & testo
inf.Close
Set inf=Nothing
Set Fil=CreateObject("Scripting.FileSystemObject")
Set out=Fil.createTextFile("PERCORSODELFILE\NOMEDELFILE.TXT",true)
for t=1 to 5
out.WriteLine(messaggio(t))
next
out.Close
Set out=Nothing
Set Fil=Nothing
response.redirect "/"
%>
<%
REM qui il server legge 5 righe di testo memorizzate sul server nel file TestoinHp.txt
REM e compone in una variabile la scritta da visualizzare
DIM MESSAGGIO(5)
Set Fil=CreateObject("Scripting.FileSystemObject")
Set inf=Fil.OpenTextFile("PERCORSODELFILE\NOMEDELFILE.TXT",1,true)
for t=1 to 5
if inf.AtEndofStream then exit for
MESSAGGIO(t)=inf.ReadLine()
if MESSAGGIO(t)<>"" then MESSAGGIOMARQUEE=MESSAGGIOMARQUEE & " - " & MESSAGGIO(t)
next
inf.Close
Set inf=Nothing
REM seguono delle righe in HTML che visualizzano la scritta scorrevole
REM nonchè la form che invierà un nuovo messaggio sul server
REM c'è anche il javascript che fa il controllo dei caratteri imessi
REM che non devono superare il numero di 100
%>
<center>
<marquee width=500 border=0 BGCOLOR=blue title="scorrimento" behavior="scroll" repeat="continuosly" direction="left" scrollAmount="5" onMouseOver="this.scrollAmount=1" onMouseOut="this.scrollAmount=5" onMouseDown="this.scrollAmount=1" onMouseUp="this.scrollAmount=1">
<font color=white>
<% = "Ultimi messaggi inseriti" & MESSAGGIOMARQUEE %>
</font>
</marquee>
<table>
<tr>
<td width=200>
<FORM name="inviamsg" method="post" action="/insermessaggio.asp">
<p align=justify>
<font size=2>
<br><b>Scrivi un tuo messaggio!!!</b><br>Lo vedrai comparire nel testo scorrevole che vedi in alto!<br><br>
</font>
</p>
<TABLE CELLPADDING=0 CELLSPACING=0 align=center border=0>
<TR>
<td width=70 align=right><b>Nome:</b></td>
<td width=130>
<input type="text" name="nick" size="15" maxlength="15" value="">
<INPUT type="hidden" name="send" value="yes">
</td>
</TR>
<TR>
<td align=center width=70>
<b>Messaggio:</b><br><br><br><font size="1"><b>Caratteri<br>disponibili</b></font><br><br>
<input type="text" readonly name="charsleft" size="3" value="100"><br><br>
<input type="submit" value="Invia" name="invia">
</td>
<td width=130>
<textarea name="testo" rows="11" cols="12" OnKeyUp="calcCharLeft()" OnChange="calcCharLeft()"></textarea>
</td>
</TR>
</table>
</form>
</td>
</tr>
</table>
</center>
<script language="JavaScript">
<!--
function calcCharLeft(f,l1) {
var msgLen;
var MaxLength;
MaxLength = 100;
msgLen=document.inviamsg.testo.value.length;
if (msgLen >= MaxLength ){
document.inviamsg.charsleft.value= "0";
window.alert("Lunghezza stringa eccessiva: " + msgLen + " caratteri, max " + MaxLength);
document.inviamsg.testo.value=document.inviamsg.testo.value.substring(0,MaxLength);
}
else {
document.inviamsg.charsleft.value = MaxLength - msgLen;
}
}
// -->
</script>
Nonostante abbia riletto e corretto centinaia di volte il messaggio prima di postarlo mi è sfuggito questo particolare.Ribonix ha scritto:
- Codice: Seleziona tutto
REM qui il server legge 5 righe di testo memorizzate sul server nel file TestoinHp.txt
MaxLength = 100
DIM MESSAGGIO(5)
[...]
for t=1 to 5
MAXMESSAGGI=10 '<====riga aggiunta al massimo rimane nel server uno storico di 10 messaggi
for t=1 to MAXMESSAGGI '<================== riga modificata
if inf.AtEndofStream then exit for
MESSAGGIO(t)=inf.ReadLine()
next
for t=MAXMESSAGGI-1 to 1 step-1 '<========= riga modificata
MESSAGGIO(t+1)=MESSAGGIO(t)
next
[...]
for t=1 to MAXMESSAGGI '<================== riga modificata
out.WriteLine(messaggio(t))
next
IMPOTANTE: la pagina dove gira il codice asp DEVE avere l'estensione.ASP.landyl ha scritto:Una cosa, ma io ho tutte pagine HTML, poi riesco a fare un mix con ASP?
<html>
<head>
<META HTTP-EQUIV="refresh" content="1;URL=http://www.miosito.it/default.asp">
</head>
<body>
</body>
</html>
<html>
<head>
<title>Pagina di prova</title>
</head>
<body>
<%
Response.Write "oggi è: " & Now
%>
</body>
</html>
<html>
<head>
<title>Pagina di prova</title>
</head>
<body>
oggi è: 9/18/2005 9:28:02 PM
</body>
</html>
Installare un sw da amministratore e farlo usare agli utenti Autore: franco11 |
Forum: Software Windows Risposte: 4 |
Outlook importare messaggi da exchange Autore: poppo11 |
Forum: Applicazioni Office Windows Risposte: 2 |
Visitano il forum: Nessuno e 6 ospiti