Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Table cell alignment

Status
Not open for further replies.

LaPluma

Programmer
Feb 3, 2002
139
DE
Hello

I have a page here:


I have downloaded it and been allowed to customise it, so that's what I'm trying to do.

You may notice that the page generated has some untidy table columns. For instance, under Replies the figure 0 should appear, and under Views, it should read 3.

I have tried manipulating the % quanities in the code pasted below, but the columns only shift slightly. The figures generated in the VB code don't appear directly under their headings.

I'm not sure what I'm doing wrong, but would appreciate some guidance.

Many thanks

LaPluma

<%Session.LCID = 2057%>
<html>
<head>
<title>Beginners Java Forum</title>

<style type=&quot;text/css&quot;>
A:link, A:visited { text-decoration: none; color: silver }
</style>
</head>

<body bgcolor=&quot;#006699&quot;>
<p align=center>
<font face=arial color=white size=4><b>Beginners Java Forum</b></font><br>
<%

dim currentpage
if request.querystring(&quot;currentpage&quot;) = &quot;&quot; OR request.querystring(&quot;currentpage&quot;) < 1 then
currentpage = 1
else
currentpage = request.querystring(&quot;currentpage&quot;)
end if
Session(&quot;currentpage&quot;)=currentpage
set conn = Server.CreateObject(&quot;ADODB.connection&quot;)
sConnection = &quot;Provider=Microsoft.Jet.OLEDB.4.0;&quot; & _
&quot;Data Source=&quot; & Server.MapPath(&quot;beginners.mdb&quot;) & &quot;;&quot; & _
&quot;Persist Security Info=False&quot;
conn.Open(sConnection)
%>

<div align=&quot;center&quot;>
<table border=&quot;0&quot; width=&quot;90%&quot;>
<tr><td width=&quot;70%&quot;>

<FONT FACE=VERDANA COLOR=silver SIZE=1>
<%

Response.Write WriteDate (Date)

Function Suffix(number)
SELECT CASE Number
CASE 1
temp = &quot;st&quot;
CASE 2
temp = &quot;nd&quot;
case 3
temp = &quot;rd&quot;
CASE ELSE
temp = &quot;th&quot;
END SELECT
Suffix = number & temp
End Function

Function WriteDate(theDate)
WriteDate = Suffix(Day(theDate)) & &quot; &quot; & Monthname(Month(theDate)) & &quot; &quot; & Year(theDate)
End Function

%>
</FONT></b></TD></tr></table>

<center><table border=1 bordercolor=&quot;FFFFFF&quot; cellpadding=&quot;6&quot; cellspacing =&quot;0&quot;><tr><td><font face=verdana size=1 color=&quot;FFFFFF&quot;><b><a href='search.asp'>Search</a></b></font></td></tr></table></center>
<p>


<table><tr>
<td width=&quot;25%&quot; align=left><font face=verdana size=1 color=white><b>
<%Set rsot = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsot.Open &quot;SELECT * FROM board where threadP=0&quot;,conn, 3%>
<%response.write &quot;Total Topics: &quot;& rsot.recordcount &&quot;&quot;%>
<% rsot.Close %>
</b></font>
</td>

<td width=&quot;20%&quot; align=&quot;center&quot;><font face=verdana size=1 color=white><b>
<%Set rsott = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsott.Open &quot;SELECT * FROM board&quot;,conn, 3%>
<%response.write &quot;Total Posts: &quot;& rsott.recordcount &&quot;&quot;%>
<% rsott.Close %>
</b></font>
</td>
</tr>
</table>
</p>
</div>


<div align=center>
<p>
<table border=1 width=90% cellpadding=1 cellspacing=0>
<tr>
<td width=40%><p align=center><font face=verdana size=1 color=white><b>Thread</b></font></td>
<td width=20%><p align=center><font face=verdana size=1 color=white><b>Replies</b></font></td>
<td width=20%><p align=center><font face=verdana size=1 color=white><b>Views</b></font></td>
<td width=20%><p align=center><font face=verdana size=1 color=white><b>Recent post</b></font></td>
</tr>
</table>
</p>
</div>
<%
Set rsttrv = Server.CreateObject(&quot;ADODB.Recordset&quot;)

rsttrv.CursorLocation = 3 'set cursorlocation to aduserclient
rsttrv.CacheSize = 10 'cache the number of record to display per page into cache
rsttrv.Open &quot;SELECT * FROM board WHERE ThreadP=0 ORDER BY msgID DESC&quot;, conn, 3

if rsttrv.EOF then Response.Write &quot;<p align=center><font face=verdana size=1 color=silver><b>No Post Yet</b></font>&quot;
rsttrv.PageSize = 10 'Set that each page will list 10 records

Dim TotalPages, TotalRecords
TotalPages = rsttrv.PageCount 'Pagecount calculates the number of pages needed based on 10 records per page
TotalRecords = rsttrv.RecordCount

if rsttrv.RecordCount > 0 then
rsttrv.AbsolutePage = currentpage 'the currentpage value will be the rs.Absolute value
end if

Dim count 'Counting variable for the recordset
count = 0
Do While Not rsttrv.EOF AND count < rsttrv.PageSize
%>
<div align=center>
<table border=0 width=85% cellpadding=0 cellspacing=0>
<tr>
<td width=40%><font face=verdana size=1><b><a href='view.asp?msgID=<%=rsttrv(&quot;msgID&quot;)%>'><%=rsttrv(&quot;topic&quot;)%></a></b></font>
<% msgID = rsttrv(&quot;msgid&quot;)
Set rsnay = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsnay.CacheSize = 10 'cache the number of record to display per page into cache
rsnay.PageSize = 10 'Set that each page will list 10 records
rsnay.Open &quot;SELECT * FROM board WHERE ThreadID=&quot;&msgID&&quot; ORDER BY msgID&quot;, conn, 3
TotalPage = rsnay.PageCount 'Pagecount calculates the number of pages needed based on 10 records per page
if TotalPage > 1 then
Response.Write &quot;<font face='verdana' size='1' color=white>&quot;
Response.Write &quot;<b><< Page:</b> &quot;
Response.Write &quot;<select name='whatever' onChange='window.location=this.options[this.selectedIndex].value'>&quot;
Response.Write &quot;<option value='view.asp?msgID=&quot;&msgID&&quot;&seepage=1 SELECTED'> - 1 - </option>&quot;
for i = 1 to TotalPage
Response.Write &quot;<option value='view.asp?msgID=&quot;&msgID&&quot;&seepage=&quot;&i&&quot;'> - &quot;&i&&quot; - </option>&quot;
next
Response.Write &quot;</select>&quot;
Response.Write &quot; >>&quot;
end if
%>
</td>
<td width=20% align=center>
<% if instr(rsttrv(&quot;email&quot;) & &quot;&quot; , &quot;@&quot;) > 0 then %>
<font face=verdana size=1><b><a href='mailto:<%=trim(rsttrv(&quot;email&quot;))%>'><%=trim(rsttrv(&quot;name&quot;))%></a></b></font>
<%else%>
<font face=verdana size=1 color=white><b><%=rsttrv(&quot;name&quot;)%></b></font>
<% end if %>
</td>
<%
Set rsr = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsr.Open &quot;SELECT * FROM board WHERE ThreadID=&quot;&msgID&&quot;AND ThreadP=1&quot;,conn, 3
%>
<td width=10% align=center><font face=verdana color=silver size=1><b><%=rsr.recordcount%></b></font></td>
<td width=10% align=center><font face=verdana color=silver size=1><b><%=rsttrv(&quot;count&quot;)%></b></font></td>
<%
if rsr.recordcount <> 0 then
Set rslp = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rslp.Open &quot;SELECT * FROM board WHERE ThreadID=&quot;&msgID&&quot; ORDER BY msgID&quot;,conn, 3
rslp.MoveLast
%>
<td width=10%><font face=verdana color=white size=1><b><%=rslp(&quot;date&quot;)%> by </b></font>
<% if instr(rslp(&quot;email&quot;) & &quot;&quot; , &quot;@&quot;) > 0 then %>
<font face=verdana color=silver size=1><b><a href='mailto:<%=trim(rslp(&quot;email&quot;))%>'><%=trim(rslp(&quot;name&quot;))%></a></b></font>
<% else %>
<font face=verdana color=white size=1><b><%=rslp(&quot;name&quot;)%></b></font>
<% end if %>
</td>
<% else %>
<td width=&quot;20%&quot;><font face=verdana color=white size=1><b><%=rsttrv(&quot;date&quot;)%></b></font></td>
<% end if %>
</tr></table>
</div>
<%
count = count + 1
rsttrv.MoveNext
Loop
%>
<br>
<p align=center>
<font face=verdana size=1 color=silver><b><a href=&quot;post.asp&quot;><u>Post New Topic</u></a></b></font>
<br>
<br>
<%
Response.Write &quot;<div align=center>&quot;
Response.Write &quot;<table border=0 width=840>&quot;
Response.Write &quot;<tr>&quot;
Response.Write &quot;<td width=210><p align=left><font face=verdana size=1><b>&quot;
if rsttrv.RecordCount > 0 then
if currentpage > 1 then
Response.Write &quot;<a href='default.asp?currentpage=1'>First</a>&quot;
end if
end if
Response.Write &quot;</b></font></td>&quot;
Response.Write &quot;<td width=210><p align=center><font face=verdana size=1><b>&quot;

if rsttrv.RecordCount > 0 then
if currentpage > 1 then
Response.Write &quot;<a href='default.asp?currentpage=&quot; & currentpage - 1 &&quot;'><< Pervious</a>&quot;
end if
end if

Response.Write &quot;</b></font></td>&quot;
Response.Write &quot;<td width=210><p align=center><font face=verdana size=1><b>&quot;

if rsttrv.RecordCount > 0 then
if CInt(currentpage) <> CInt(TotalPages) then
Response.Write &quot;<a href='default.asp?currentpage=&quot; & currentpage + 1 &&quot;'>Next >></a>&quot;
end if
end if

Response.Write &quot;</b></font></td>&quot;
Response.Write &quot;<td width=210><p align=center><font face=verdana size=1><b>&quot;

if rsttrv.RecordCount > 0 then
if CInt(currentpage) <> CInt(TotalPages) then
Response.Write &quot;<a href='default.asp?currentpage=&quot; & TotalPages &&quot;'>Last</a>&quot;
end if
end if

Response.Write &quot;</b></font></td>&quot;
Response.Write &quot;</tr></table></div>&quot;
%>
<%
if TotalPages > 1 then
Response.Write &quot;<center>&quot;
Response.Write &quot;<font face='verdana' size='1' color=white>&quot;
Response.Write &quot;<b>Page:</b> &quot;
Response.Write &quot;<select name='whatever' onChange='window.location=this.options[this.selectedIndex].value'>&quot;
Response.Write &quot;<option value='default.asp?currentpage=&quot;&currentpage&&quot; SELECTED'> - &quot;&currentpage&&quot; - </option>&quot;
for i = 1 to TotalPages
if cStr(currentpage) <> cStr(i) then
Response.Write &quot;<option value='default.asp?currentpage=&quot;&i&&quot;'> - &quot;&i&&quot; - </option>&quot;
end if
next
Response.Write &quot;</select>&quot;
Response.Write &quot;</font>&quot;
Response.Write &quot;</center>&quot;

Response.Write &quot;<font face=verdana size=1 color=white>&quot;
Response.Write &quot;<p align=center>&quot;
Response.Write(&quot;Page &quot; & currentpage & &quot; of &quot; & TotalPages & &quot;</p>&quot;)
Response.Write &quot;</font>&quot;
end if
%>
<%
conn.Close
Set conn = Nothing
%>
<center>
<font face=verdana size=1 color=white>Developed by </font><a href='mailto:stevehigham2002@yahoo.co.uk'><font face=verdana size=1>Steve Higham</font></a></font>
</center>
</body>
</html>
 
hey your top table have width of 90%

and table below of it have width of 85%
set it to 90%

send me reply on sawantprasad2001@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top