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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

force linear text into adjacent table cells

Status
Not open for further replies.

ringadeal

Technical User
Jan 16, 2008
67
US
wondering if there is a way to format designated html paragraph text so that it falls inside cells of a table
where each return would signify a new <tr> table row and each colon:)) would signify a new <td> table cell as follows:

seat height:18"
seat depth: 17"

should convert to:
Code:
<tr>
 <td>seat height</td>
 <td>18"</td>
</tr>
<tr>
 <td>seat depth</td>
 <td>17"</td>
</tr>
 
If you have the text including the returns in a string variable you can simply add "<tr><td>" at the front, "</td></tr>" at the end and then use the Replace function for the colons and returns. For details of Replace see:
___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
thanks a lot for your response. I have tried the following:
Code:
<%
dim memo
dim rmemo
dim rrmemo
memo=(products.Fields.Item("CustomMemo01").Value)
rmemo=Replace(memo,":","</td><td>")
rrmemo=Replace(rmemo,"\r","</td></tr><tr><td>")
%>
Am receiving this error with the arrow pointing to the colon:

Microsoft VBScript compilation error '800a03ea'

Syntax error

/new_web_product_detail.asp, line 30

rmemo=Replace(memo,:,</td><td>)
 
correction to the above submision:

no error message but something is wrong with my code. When testing the values of the variables by doing a response.write, only the value of the "memo" variable displays. All other variables display as their actual variable name rather than value.

Please note i am extremely new to asp!
 
Show us how you are displaying the variables

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
response.write(memo) works on displaying the variable named "memo" but won't display anything for the variable "rmemo" or "rrmemo" in the following page code:
Code:
 <table width="100%"  border="0">
                                                <tr>
                          <td>Cube</td>
                          <td><%=(products.Fields.Item("SerialNumber").Value)%></td>
                        </tr>
                        <tr>
                          <td>Count Per Carton </td>
                          <td><%=(products.Fields.Item("CustomNumber01").Value)%></td>
                        </tr>
                                                <tr>
                          <td><%response.write(rmemo)%></td>
                        </tr>
                      </table>
 
it will simply write the variable name such as the word "rmemo" or "rrmemo" in place of diplaying the VALUE of the variable
 
sorry for being inaccurate again.
I've tested again and have finalized that
<%response.write(memo)%> displays fine by showing the value of the variable named "memo"
<%response.write(rmemo)%> does not display anything at all
and
<%response.write(rrmemo)%> simply displays the word "rmemo"

your assistance is much appreciated!!!
 
okay, I got it to work until rrmemo.
this second replace function is not working
rrmemo=Replace(rmemo,"\r","</td></tr><tr><td>")

can i not do one replace function over another one?
 
Replace will work fine on any string. Have you checked that your input string actually contains a "\r" string? It could contain a VBCRLF sequence which is Chr(13)Chr(10) instead.

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top