PDA

View Full Version : converting html to response.write


aabruzzese
09-29-2002, 11:19 PM
Hi guys

I need to figure out how to convert the following line into a
response.write statement.

<A HREF="./Firemission6.asp?action=AddShip&Ship=<%= fkey %>"><img width=42 height=42 border=0 vspace=0 SRC="<%= Patrol%>"></A><br><%= Name%>


This is inside a loop and is causing me a headache as I am unable to convert it into a response.write statement.


Regards
Angelo

whammy
09-30-2002, 03:00 AM
Response.Write("<a href=""./Firemission6.asp?action=AddShip&Ship=" & fkey & """><img width=""42"" height=""42"" border=""0"" vspace=""0"" src=""" & Patrol & """></a><br />" & Name)


Which, for me, results in:

<a href="./Firemission6.asp?action=AddShip&Ship="><img width="42" height="42" border="0" vspace="0" src=""></a><br />

Since I didn't gave a value to any of the variables you're using. But it displays perfectly, so the syntax is right.

* Note: The code might look a bit funny to you, since I am using XHTML compliant scripting as a habit - i.e. all lowercase html tags, each value surrounded by quotes, and formerly unclosed tags such as <br> closed within the tag. But not to worry - even if the rest of your code is not XHTML compliant, it is backwards compatible so you should be able to use it as is. :)

aabruzzese
09-30-2002, 12:38 PM
Whammy,

Thanks for the help on it, it works fine. One thing I did end up
doing is finding a html2asp script out there on the web that
did just that.

It takes a longwinded html code line and converts to
asp.


One thing I have to sit down and do is learn to build those more
complex response.write statements, so I need to figure the rule
that applies to items that are encapsulated within ".


Thanks
Angelo

whammy
09-30-2002, 02:36 PM
Simple, each " WITHIN the quotes that surround the string needs another " to escape it. :)