Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 11th, 2005, 07:18 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default loop

I have a HTML table and asp code as below:

<table width="650" bgcolor="#ECECEC" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="16" bgcolor="#ECECEC"><img src="images/top_lefbb.gif" width="16" height="16"></td>
    <td height="16" bgcolor="#ECECEC" background="images/top_midbb.gif"><img src="images/top_midbb.gif" width="16" height="16"></td>
    <td width="24" bgcolor="#ECECEC"><img src="images/top_rigbb.gif" width="24" height="16"></td>
  </tr>
  <tr>
    <td width="16" background="images/cen_lef.gif"><img src="images/cen_lef.gif" width="16" height="11"></td>
    <td><Table width="100%" border="1" bordercolor="#666666" align="center" cellpadding="0" cellspacing="1">
        <tr bgcolor="#006699" bordercolor="#000000" border="1"><Td colspan="3" align="Left"><span class="style1"><strong>Fare Breakdown</strong></span></td>
          </tr>
          <tr>
              <td width="43%" height="25" align="center" bordercolor="#ececec" border="0">
              Contract Number: <b><%=tour_code%></b>
              </td>
              </tr>
            <tr><td>Adult Net Net</td>
            <tr><td>Markup</td>

<%
dim arrStr
dim theStr

theStr = xmldoc.documentelement.selectnodes("dataElementsMa ster").item(0).selectnodes("dataElementsIndiv").it em(2).selectnodes("miscellaneousRemarks").item(0). selectnodes("remarks").item(0).selectnodes("freete xt").item(0).text
arrStr = Split(theStr,",")

for i=0 to Ubound(arrStr)
arrStr2 = Split(arrStr(i),";")
next

Dim expr: Set expr = New RegExp
expr.Pattern = "[^:]*:([^,]*),?"
expr.Global = True
Dim matches
Set matches = expr.Execute(theStr)
If matches.Count > 10 Then
    tour_code = Mid(Matches.Item(10).SubMatches(0), 2,2) & "<br />"
End If
Set matches = Nothing
Set expr = Nothing

Dim expression: Set expression = New RegExp
expression.Pattern = "[^:]*:([^,]*),?"
expression.Global = True
Dim match, first_matches
Set first_matches = expression.Execute(theStr)

For Each match In first_matches

    response.write "<td>" & match.SubMatches(0) & "</td></tr>"
Next
Set first_matches = Nothing
Set expression = Nothing
%>

    </table>
    </td>
    <td width="24" background="images/cen_rigBB.gif" bgcolor="#ECECEC"><img src="images/cen_rigBB.gif" width="24" height="11"></td>
  </tr>
  <tr bgcolor="#ECECEC">
    <td width="16" height="16"><img src="images/bot_lefbb.gif" width="16" height="16"></td>
    <td height="16" bgcolor="#ECECEC" background="images/bot_midbb.gif"><img src="images/bot_midbb.gif" width="16" height="16"></td>
    <td width="24" height="16" bgcolor="#ECECEC"><img src="images/bot_rigbb.gif" width="24" height="16"></td>
  </tr>
</table>


However, i am experiancing problems getting the <td> to show correctly.

How can I get Adult Net Net to sit beside 134
and Markup to side beside the 2nd value in the loop (which is 0)

example:

<tr>
<td>Adult Net Net</td>
<td>*value 1 from the loop in HERE*</td>
</tr>

<tr>
<td>Markup</td>
<td>*value 2 from the loop in HERE*</td>
</tr>

Thanks in advance.

Picco

www.crmpicco.co.uk
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old February 12th, 2005, 09:12 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Sounds like an HTML error in displaying your information?

Go thru your code and make sure a <td> is followed by a </td>
                            and a <tr> is followed by a </tr>

Throw border="1" inside your table tag to show cells and rows, this will illustrate where some holes are.

What I can see at a glance:

<tr><td>Adult Net Net</td>
<tr><td>Markup</td> (Where is your closing </tr> tag)

The next one I see is inside your loop:

For Each match In first_matches
   response.write "<td>" & match.SubMatches(0) & "</td></tr>"
Next

If you are going to have a </tr> inside a loop you usually have a <tr>.

HTML is the simple stuff, look at your code carefully. View the source in the browser, look at the HTML thats being created. Use table borders to see whats cells and rows are being produced. Use Ctrl + f to search for tags therefore finding missing tags. IMO Perhaps most importantly use code indentations when creating a page (you are doing this at the top of your page, then it kind of goes astray.)

HTH



Wind is your friend
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with for-each loop athanatos XSLT 0 April 10th, 2006 07:20 PM
Do Until loop with IF crmpicco Classic ASP Databases 2 June 15th, 2005 05:35 PM
For....Loop kliu9 Excel VBA 5 February 10th, 2005 06:43 AM
Do Loop junemo Beginning PHP 8 July 28th, 2004 02:58 AM
nested while loop doesn't loop hosefo81 PHP Databases 5 November 12th, 2003 08:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.