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!

rowspan / Colspan / Loop?

Status
Not open for further replies.

craigey

Technical User
Apr 18, 2002
510
GB
Hi,

I have an ASP script that reads each line in my database. It then outputs this line to a table. It creates a table and then loops to the next line in the database, for which it creates another table. So far all I can do is have all the Tables listed down the page or across the page. I have 12 lines in the database and would like it to span across 4 Columns and 3 rows.

The code goes a little bit like this
<script>

<TABLE>
<TD WIDTH=&quot;25%&quot;>
<%
strWEBSITENAME = rs(&quot;websitename&quot;)
Response.write(strWEBSITENAME & &quot; &quot;) %>
</TD>

rs.MoveNext
Loop

rs.Close
conn.Close
Set rs = Nothing
Set conn = Nothing

</script>

This isn't the complete code obviously as the page is sitting at home, whilst I'm at work. If youneed it I'll post it later!

 
Please ingnore the <script> and the </script> tags. I made a mistake using the TGML code!
 
how about something like this

Code:
<TABLE COLS=4 WIDTH=600 CELLSPACING=0 CELLPADDING=0 BORDER=0>
<TR>
<%
Dim intCount
intCount = 0

While NOT objRecordset.EOF
  If intCount = 4 Then
    Response.Write &quot;</TR>&quot; & vbcrlf & &quot;<TR>&quot; & vbcrlf
    intCount = 0
  End If

  Response.Write &quot;<TD>&quot; & objRecordset(&quot;Data&quot;) & &quot;</TD>&quot;
  intCount = intCount + 1
  objRecordset.MoveNext
Wend

Do While intCount <> 4
  Response.Write &quot;<TD>&amp;nbsp;</TD>&quot;
  intCount = intCount + 1
Loop
%>
</TR>
</TABLE>
Tony
 
Can anyone tell me how to incoporate the code above to use an IFRAME to display a website using XMLhttp to get the html code. Currently I have the script below:
Code:
<% @ Language=VBScript %> 
<% Option Explicit %>
<%

Response.Expires = 0
    	Response.Buffer = True
    	Response.Clear
    	server.ScriptTimeout = 300
   Dim conn, connString, rs, sql

   sql = &quot;SELECT * FROM urllist;&quot;

   Set conn = Server.CReateObject(&quot;ADODB.Connection&quot;)

   connString = &quot;DRIVER={Microsoft Access Driver (*.mdb)};&quot; & _
        &quot;DBQ=C:\Inetpub\[URL unfurl="true"]wwwroot\urlchecking\2kdatabase.mdb;&quot;[/URL]

  conn.Open connString

   Set rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)

   rs.Open sql, conn, 3, 3

 Dim strURL, strWEBSITENAME, objhttp, sHTML, sTxt, strFrom, p
 
    If not rs.EOF Then
        Do while not rs.EOF
          strURL = rs(&quot;url&quot;)
          If left(lcase(strURL),7)<>&quot;[URL unfurl="true"]http://&quot;[/URL] Then 
          strURL=&quot;[URL unfurl="true"]http://&quot;[/URL] & strURL
          End if
          On Error Resume Next
          Set objhttp = Server.CreateObject (&quot;Microsoft.XMLHTTP&quot;)
          objhttp.open &quot;GET&quot;, strURL, False
          objhttp.send
          sHTML=objhttp.statusText
          If err or sHTML<>&quot;OK&quot; Then
              sTxt=&quot;FAILED&quot;
          Else
              sTxt=&quot;ok&quot;
          End if
          Set objhttp=nothing 
          
          strWEBSITENAME = rs(&quot;websitename&quot;)
        %>
<body>

<table>
</table>
<table border=&quot;0&quot; width=&quot;25%&quot; id=&quot;AutoNumber1&quot;>
  <center>
  <caption><br>
  <% Response.write(strWEBSITENAME)%> <br>
  <iframe id=&quot;AutoNumber1&quot; width=&quot;150&quot; height=&quot;150&quot; src=&quot;<%=rs(&quot;url&quot;)%>&quot;>
  </iframe></center>
  <%
 
        rs.MoveNext
        Loop
      Else
              Response.write(&quot;There were no URL's listed in the Database.&quot;)
      End If
  rs.Close
  conn.Close
  Set rs = Nothing
  Set conn = Nothing
  Set objhttp=nothing

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top