By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,955 Members | 1,768 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,955 IT Pros & Developers. It's quick & easy.

Positioning HTML tables

P: n/a
Hi,

I have a group of 5 tables laid out of the web page. 2 go on the left
side and 3 on the right. These tables retrieve data from the database
so the number of records (rows) returned varies.

So the problem I am having at the moment is that if the table gets
longer by one or two rows, all my alignment goes of out whack for the
other tables. Is there a way for example to place table #2 right after
table#1 ends?

Table #1 Table #3

Table #4
Table #2
Table #5

Oct 11 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
al******@gmail.com wrote:
Hi,

I have a group of 5 tables laid out of the web page. 2 go on the left
side and 3 on the right. These tables retrieve data from the database
so the number of records (rows) returned varies.

So the problem I am having at the moment is that if the table gets
longer by one or two rows, all my alignment goes of out whack for the
other tables. Is there a way for example to place table #2 right after
table#1 ends?

Table #1 Table #3

Table #4
Table #2
Table #5
How can anyone tell why this is happening if you're keeping the code
that's causing it a secret?
Oct 11 '06 #2

P: n/a
The code is no secret....its just lengthy so I chose not to include it.
Here it is:

....
<script language="Javascript"
src="/shared/javascript/validate.js"></script>
<script language="Javascript"
src="/shared/javascript/validation.js"></script>
<STYLE type="text/css">
div.RightTable1 {POSITION: relative; left: 10px; top: -1895px}
div.RightTable2 {POSITION: relative; left: 10px; top: -2900px}
div.RightTable3 {POSITION: relative; left: 10px; top: -2890px}
div.LeftTable1 {POSITION: relative; top: -1520px}
</style>
</head>
<%
.....

Sub Main()
DisplaySignups
DisplayMonthlyAccess
DisplayCountByState
DisplayCountByIndustry
DisplayCountByStateInd
End Sub

Sub DisplaySignups
Dim monthNo, yearNo, countSignups
Dim rsSignups : Set rsSignups = SummaryInfo("SIGNUP BY MONTH")

If Not rsSignups.EOF AND Not rsSignups.BOF Then
xmlSummary = xmlSummary & "<sign-ups>"
rsSignups.MoveFirst
Do While Not rsSignups.EOF
monthNo =
ConvertNullToString(ReplaceSpecialCharacters(rsSig nups.Fields("month_no")))
yearNo =
ConvertNullToString(ReplaceSpecialCharacters(rsSig nups.Fields("year_no")))
countSignups =
ConvertNullToString(ReplaceSpecialCharacters(rsSig nups.Fields("count")))
xmlSummary = xmlSummary & "<sign-up><count>" & countSignups &
"</count><month>" & monthNo & "</month><year>" & yearNo &
"</year></sign-up>"
rsSignups.MoveNext
Loop

xmlSummary = xmlSummary & "</sign-ups>"
rsSignups.Close
End If

Set rsSignups = Nothing

If strXSLFile <"" Then
strHTML = TransformXML(xmlSummary, strXSLFile)
If strHTML <"" Then
FrameMe "User Sign Up's via eFinance-it by Month", strHTML, "50%"
End If
End If

xmlSummary=""
End Sub

Sub DisplayMonthlyAccess
Dim appName, monthNo, yearNo, visitorCount
Dim rsAccess : Set rsAccess = SummaryInfo("ACCESS BY MONTH")

If Not rsAccess.EOF AND Not rsAccess.BOF Then
xmlSummary = xmlSummary & "<monthly-access>"
rsAccess.MoveFirst
Do While Not rsAccess.EOF
appName =
ConvertNullToString(ReplaceSpecialCharacters(rsAcc ess.Fields("app_name")))
monthNo =
ConvertNullToString(ReplaceSpecialCharacters(rsAcc ess.Fields("month_no")))
yearNo =
ConvertNullToString(ReplaceSpecialCharacters(rsAcc ess.Fields("year_no")))
visitorCount =
ConvertNullToString(ReplaceSpecialCharacters(rsAcc ess.Fields("visitor_cnt")))
xmlSummary = xmlSummary & "<month-access><app-name>" & appName &
"</app-name><month>" & monthNo & "</month><year>" & yearNo &
"</year><count>" & visitorCount & "</count></month-access>"
rsAccess.MoveNext
Loop

xmlSummary = xmlSummary & "</monthly-access>"
rsAccess.Close
End If

Set rsAccess = Nothing

If strXSLFile <"" Then
strHTML = TransformXML(xmlSummary, strXSLFile)
If strHTML <"" Then%>
<div align="right" class="RightTable1" >
<%FrameMeWithNote "Registered eFinance-it User Access by Month",
"<font color=""red"">Excludes Jacksonville</font>", strHTML, "50%"
End If
End If%>
</div>
<%
xmlSummary=""
End Sub

Sub DisplayCountByState
Dim stateName, country, count
Dim rsCount : Set rsCount = SummaryInfo("COUNT BY STATE")

If Not rsCount.EOF AND Not rsCount.BOF Then
xmlSummary = xmlSummary & "<state-count>"
rsCount.MoveFirst
Do While Not rsCount.EOF
stateName =
ConvertNullToString(ReplaceSpecialCharacters(rsCou nt.Fields("state_name")))
country =
ConvertNullToString(ReplaceSpecialCharacters(rsCou nt.Fields("country")))
count =
ConvertNullToString(ReplaceSpecialCharacters(rsCou nt.Fields("client_cnt")))
xmlSummary = xmlSummary & "<state><state-name>" & stateName &
"</state-name><country>" & country & "</country><count>" & count &
"</count></state>"
rsCount.MoveNext
Loop

xmlSummary = xmlSummary & "</state-count>"
rsCount.Close
End If

Set rsCount = Nothing

If strXSLFile <"" Then
strHTML = TransformXML(xmlSummary, strXSLFile)
If strHTML <"" Then%>
<div class="LeftTable1">
<%FrameMe "Registered eFinance-it User Count By State", strHTML,
"50%"
End If
End If%>
</div>
<%xmlSummary=""
End Sub

Sub DisplayCountByIndustry
Dim industryName, count
Dim rsCount : Set rsCount = SummaryInfo("COUNT BY IND")

If Not rsCount.EOF AND Not rsCount.BOF Then
xmlSummary = xmlSummary & "<industry-count>"
rsCount.MoveFirst
Do While Not rsCount.EOF
industryName =
ConvertNullToString(ReplaceSpecialCharacters(rsCou nt.Fields("SIC_Class_desc")))
count =
ConvertNullToString(ReplaceSpecialCharacters(rsCou nt.Fields("client_cnt")))
xmlSummary = xmlSummary & "<industry><industry-name>" & industryName
& "</industry-name><count>" & count & "</count></industry>"
rsCount.MoveNext
Loop

xmlSummary = xmlSummary & "</industry-count>"
rsCount.Close
End If

Set rsCount = Nothing

If strXSLFile <"" Then
strHTML = TransformXML(xmlSummary, strXSLFile)
If strHTML <"" Then%>
<div align="right" class="RightTable2">
<%FrameMe "Registered eFinance-it User Count By Industry", strHTML,
"50%"
End If
End If%>
</div>
<%xmlSummary=""
End Sub

Sub DisplayCountByStateInd
Dim industryName, count, stateName
Dim rsCount : Set rsCount = SummaryInfo("COUNT BY ST IND")

If Not rsCount.EOF AND Not rsCount.BOF Then
xmlSummary = xmlSummary & "<stateind-count>"
rsCount.MoveFirst
Do While Not rsCount.EOF
stateName =
ConvertNullToString(ReplaceSpecialCharacters(rsCou nt.Fields("client_state")))
industryName =
ConvertNullToString(ReplaceSpecialCharacters(rsCou nt.Fields("SIC_Class_desc")))
count =
ConvertNullToString(ReplaceSpecialCharacters(rsCou nt.Fields("client_cnt")))
xmlSummary = xmlSummary & "<state-ind><state-name>" & stateName &
"</state-name><industry-name>" & industryName &
"</industry-name><count>" & count & "</count></state-ind>"
rsCount.MoveNext
Loop

xmlSummary = xmlSummary & "</stateind-count>"
rsCount.Close
End If

Set rsCount = Nothing

If strXSLFile <"" Then
strHTML = TransformXML(xmlSummary, strXSLFile)
If strHTML <"" Then%>
<div align="right" class="RightTable3">
<%FrameMe "Registered eFinance-it User Count By State/Industry",
strHTML, "50%"
End If
End If%>
</div>
<%xmlSummary=""
End Sub
Function SummaryInfo(SubDetailTx)
Const reRecordset = 1
Dim SPID : SPID = ""
Dim RetXML : RetXML = ""
Dim oXMLRetrieve, rsSummary, XML_SP

'check for SubDetailTx
Select Case UCase(SubDetailTx)
Case "SIGNUP BY MONTH": SPID = SIGNUP_SPID
Case "COUNT BY STATE": SPID = COUNT_ST_SPID
Case "COUNT BY IND": SPID = COUNT_IND_SPID
Case "COUNT BY ST IND": SPID = COUNT_ST_IND_SPID
Case "ACCESS BY MONTH": SPID = ACCESS_SPID
Case Else RetXML = ""
End Select

XML_SP = XML_SP & "<sp name='"& SPID & "' db-code='33'>"
XML_SP = XML_SP & "</sp>"

Set oXMLRetrieve = Server.Createobject("ReportEngine.Retrieval")
Set rsSummary = oXMLRetrieve.ExecuteQuery(reRecordSet,XML_SP)

Set SummaryInfo = rsSummary
End Function
Harlan Messinger wrote:
al******@gmail.com wrote:
Hi,

I have a group of 5 tables laid out of the web page. 2 go on the left
side and 3 on the right. These tables retrieve data from the database
so the number of records (rows) returned varies.

So the problem I am having at the moment is that if the table gets
longer by one or two rows, all my alignment goes of out whack for the
other tables. Is there a way for example to place table #2 right after
table#1 ends?

Table #1 Table #3

Table #4
Table #2
Table #5

How can anyone tell why this is happening if you're keeping the code
that's causing it a secret?
Oct 11 '06 #3

P: n/a
al******@gmail.com schrieb:
Harlan Messinger wrote:
[...]
>How can anyone tell why this is happening if you're keeping the code
that's causing it a secret?
The code is no secret....its just lengthy so I chose not to include it.
Here it is:
[snip code]

1. You misunderstood it - your ASP (or whatever it is) code is not
helpful, but the HTML and CSS code of the page generated.

2. In Usenet you are required to avoid top-posting - leave the parts of
the original message that you reply to, and place your reply below it.

3. From the style part of the code you submitted I see that you
misunderstand the concept of relative positioning. Relative positioning
makes a container the reference for absolute positioning of the
contained elements:

<div class="container">
<div class="contents">This is my contents</div>
</div>

CSS:
..container { position:relative; }
..contents { position:absolute; top:...... }

So the contents element is positioned relatively to the container
element rather than to the body.

Anyway generally I don't think that absolute positioning is a way to go
with your tables, as you don't know the heights (as you mentioned
yourself in the original posting). If you need 2 columns you might be
successful with floated divs, such as:

<div id="left_container">
<table>...</table>
<table>...</table>
</div>
<div id="right_container">
<table>...</table>
<table>...</table>
</div>

CSS:
#left_container, #right_container { float:left; }

If you google for CSS column layouts you will find lots of info about this.

HTH
Markus
Oct 12 '06 #4

P: n/a
al******@gmail.com wrote:
[top-posting corrected]
Harlan Messinger wrote:
>al******@gmail.com wrote:
>>Hi,

I have a group of 5 tables laid out of the web page. 2 go on the left
side and 3 on the right. These tables retrieve data from the database
so the number of records (rows) returned varies.

So the problem I am having at the moment is that if the table gets
longer by one or two rows, all my alignment goes of out whack for the
other tables. Is there a way for example to place table #2 right after
table#1 ends?

Table #1 Table #3

Table #4
Table #2
Table #5
How can anyone tell why this is happening if you're keeping the code
that's causing it a secret?
The code is no secret....its just lengthy so I chose not to include it.
That's like calling the doctor and asking him to tell you over the phone
what to do about your sore throat without having you come in so he can
examine your throat, take your temperature, feel your glands, and draw
your blood, because that seems like a lot of trouble. Maybe so, but
without an examination he can't tell you anything.
Here it is:

...
<script language="Javascript"
src="/shared/javascript/validate.js"></script>
<script language="Javascript"
src="/shared/javascript/validation.js"></script>
<STYLE type="text/css">
div.RightTable1 {POSITION: relative; left: 10px; top: -1895px}
div.RightTable2 {POSITION: relative; left: 10px; top: -2900px}
div.RightTable3 {POSITION: relative; left: 10px; top: -2890px}
div.LeftTable1 {POSITION: relative; top: -1520px}
</style>
</head>
[...]
I don't know what you're trying to accomplish with the relative
positioning, but what you're saying is: take any DIV having class
LeftTable1 and reposition it 1520 pixels higher than it would be if you
weren't using relative positioning on *any* of the elements; and move
DIVs belonging to the other classes up the page similarly, as well as
moving them 10 pixels to the left of where they would otherwise be if
you weren't using relative positioning at all. As far as I know that's
exactly what's happening on your page, but I have no way to know because
I can't see your page, and because you haven't even provided the HTML,
only the ASP code that generates it, which is useless for figuring out
what the browser is doing.
Oct 12 '06 #5

P: n/a
I don't know what you're trying to accomplish with the relative
positioning, but what you're saying is: take any DIV having class
LeftTable1 and reposition it 1520 pixels higher than it would be if you
weren't using relative positioning on *any* of the elements; and move
DIVs belonging to the other classes up the page similarly, as well as
moving them 10 pixels to the left of where they would otherwise be if
you weren't using relative positioning at all. As far as I know that's
exactly what's happening on your page, but I have no way to know because
I can't see your page, and because you haven't even provided the HTML,
only the ASP code that generates it, which is useless for figuring out
what the browser is doing.
Thanks for your responses, I appreciate it. The HTML is in the XSL
file, but no worries I was able to figure it out with the help of the
comments that were already posted.

I tooked out the DIV classes and created these...

#left_container{float:left;margin: 0 0 5px 5px;}
#right_container{float:right;margin: 0 0 5px 5px;}

in the left container i put my 2 left tables (ie. <div
id="left_container"><table></table><table></table></div>)

in the right container i put the 3 right ones

and no other styling was necessary for positioning as each table
automatically goes after the one before it (no matter the
length)...which is exactly what I had wanted

Sorry for the confusion, I guess it would've made more sense to include
the HTML! :)

And sorry I can't provide u with a link to the page...its an intranet
site

Oct 12 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.