rondog Posted April 8, 2009 Share Posted April 8, 2009 I am loading some images via XML and I want to put them into a table of 3 columns. How can I write that? I am using this right now for loading the XML: <% Set objXML = Server.CreateObject("Microsoft.XMLDOM") Set objLst = Server.CreateObject("Microsoft.XMLDOM") Set objHdl = Server.CreateObject("Microsoft.XMLDOM") objXML.async = False objXML.Load (Server.MapPath("test.xml")) If objXML.parseError.errorCode <> 0 Then 'handle the error End If Set objLst = objXML.getElementsByTagName("course") noOfHeadlines = objLst.length Response.Write("<table border=""1""><tr>") For i = 0 To (noOfHeadlines - 1) Set objHdl = objLst.item(i) Response.Write("<td><img src=""" & objHdl.childNodes(5).childNodes(0).text & """ /><br></td>") Next Response.Write("</tr></table>") %> Link to comment https://forums.phpfreaks.com/topic/153211-make-3-column-table-asp/ Share on other sites More sharing options...
rondog Posted April 8, 2009 Author Share Posted April 8, 2009 I figured it out: <% Set objXML = Server.CreateObject("Microsoft.XMLDOM") Set objLst = Server.CreateObject("Microsoft.XMLDOM") Set objHdl = Server.CreateObject("Microsoft.XMLDOM") objXML.async = False objXML.Load (Server.MapPath("test.xml")) If objXML.parseError.errorCode <> 0 Then 'handle the error End If Set objLst = objXML.getElementsByTagName("course") noOfHeadlines = objLst.length numElements = noOfHeadlines numCols = 3 Response.Write("<table width=""800"" border=""1"">") For i = 0 To (noOfHeadlines - 1) needFooter = true Set objHdl = objLst.item(i) if i mod numCols = 0 then Response.Write("<tr>") end if Response.Write("<td width=""33%""><div class=""tTip"" title=""" & objHdl.childNodes(1).childNodes(0).text & """><a href=""" & objHdl.childNodes(7).childNodes(0).text & """><img src=""" & objHdl.childNodes(5).childNodes(0).text & """ /></a></div></td>") if i mod numCols = numCols - 1 then Response.Write("</tr>") needFooter = false end if Next if needFooter then Response.Write("<td colspan=""" & numCols - (i mod numCols) & """> </td></tr>") end if Response.Write("</table>") %> Link to comment https://forums.phpfreaks.com/topic/153211-make-3-column-table-asp/#findComment-804924 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.