Hjælp til rette kode til
HejJeg har skrevet følgende kode i ASP / HTML men kan nu ikke for det til, at virke.
Det virker når jeg hente første post ud af min database, men så snart jeg henter 2 eller 3 poster ud, se det helt forkert ud.
Posterne skal stå lige under hinanden, med den nyeste post øverst i rammer centreret.
Hvem kan gennemskue hvad der er galt ?
<tr><td bgcolor="#000000" width="480" height="1" colspan="2"></td></tr>
<tr><td width="480" height="10" colspan="2" align="center"></td></tr>
<tr><td width="480" height="10" colspan="2" align="center">
<table border="1" width="468" bordercolor="#000000">
<tr><td class="sort" width="468">
<br>
<table border="1" width="468" bordercolor="#000000">
</table>
</center>
</div>
<div align="center">
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr><td width="480" height="10" colspan="2" align="center"></td></tr>
<%
NyhederPerSide = 5
URL = "forside.asp"
DB = Server.MapPath("../database/portal.mdb")
Height = "150"
Width = "120"
Public Function FixSQL(ByVal sString) ' As String
If Len("" & sString) = 0 Then Exit Function
sString = Replace(sString, "'","''")
sString = Replace(sString, "\","\\")
FixSQL = sString
End Function
%>
<%Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DB
If Request.QueryString("ID") = "" Then
Set RecSet = Server.CreateObject("ADODB.Recordset")
Siden = Request.QueryString("Side")
If Siden = "" then
Side = 1
Else
Side = Siden
End If
With RecSet
.CursorLocation = 3
.CacheSize = Nyhederperside
End With
SQL = "SELECT * FROM Forside Order By ID Desc"
RecSet.Open SQL, Conn
If RecSet.EOF Then%>
<tr>
<td>Ingen Data</td>
</tr>
<%Else
With RecSet
.MoveFirst
.PageSize = NyhederPerSide
.AbsolutePage = Side
End With
Sider = RecSet.PageCount
x = 0
Do While Not RecSet.EOF And x < RecSet.PageSize%>
<td colspan="2" height="1000" valign="top"><table border="1" width="468" bordercolor="#000000">
<tr><td class="sort" width="468">
<br>
<div align="center">
<table border="1" cellpadding="0" cellspacing="0" width="450" bordercolor="#000000">
<tr><td class="sort" width="120" height="10" bordercolor="#000000" bgcolor="#DADADA"><center><b><%=FormatDateTime(RecSet("Dato"),2)%> - <%=FormatDateTime(RecSet("Dato"),4)%></b></center></td>
<td class="sort" width="348" height="10" bordercolor="#000000" bgcolor="#DADADA"> <b><%=RecSet("Emne")%></b></td></tr>
<tr><td width="120" height="150" valign="middle"><p align="center"><b><img src="foto/forsidefoto/<%=RecSet("Foto")%>" Border="0" Height="<%=Height%>" Width="<%=Width%>"></b></td>
<td class="sort" width="348" height="115" valign="top"><br> <%If Len(RecSet("Info")) > 500 Then%><%=Left(RecSet("Info"),500)%>...<%Else%><%=RecSet("Info")%><%End If%><b><a href="<%=URL%>?ID=<%=RecSet("ID")%>"> Læs mere</a></b></td></tr>
<br>
<%x=x+1
RecSet.MoveNext
Loop
RecSet.Close
If Sider > 1 Then%>
<%For Side = 1 To Sider
If (Int(Side)) = (Int(Side)) Then%><b><%=Side%></b><%Else%> <a href="<%=URL%>?side=<%=Side%>"><%=Side%></a> <%End If
Next%>
<%End If
End If
End If
If Request.QueryString("ID") <> "" Then
Set RS=Conn.Execute("Select * From Forside Where ID=" & FixSQL(Request.QueryString("ID")))%>
<td colspan="2" height="1000" valign="top"><div align="center"><center><table border="1" width="468" bordercolor="#000000">
<tr><td class="sort" width="468">
<br>
<div align="center">
<table border="1" cellpadding="0" cellspacing="0" width="450" bordercolor="#000000">
<b><%=RS("Emne")%></b> | <%=FormatDateTime(RS("Dato"),2)%> - Kl. <%=FormatDateTime(RS("Dato"),4)%>
<%=Replace(RS("Info"),vbCrLf,"<br>")%>
<br>
<a href="<%=URL%>">Tilbage</a></td></tr>
<%End If%>
</table>
</center>
</div>
</div><table border="1" width="468" bordercolor="#000000">
</table>
</center>
</div>
</div>
<br>
<br>