...

View Full Version : Response.Write()



dallen24
03-13-2004, 02:18 AM
Hi. I just wrote my first asp scripts and had a question.

Got an asp script that reads another web site's xml file, genertaing javascript array information. Such as:

dte[0] = (2004, 3-1, 14) ; mes[0] = '<a href="http://tmp.htm">title</a>'

The Response.Write() seems to take a '<a href="http:\/\/tmp.htm">title<\/a>' and convert it to '<a href="http://tmp.htm">title</a>'. Just like document.write(). The problem is that I need to do a document.write(mes[0]) in my html code.

Question. Is there a way for the asp script to generate:

dte[0] = (2004, 3-1, 14) ; mes[0] = '<a href="http:\/\/tmp.htm">title<\/a>'

shmoove
03-13-2004, 10:55 AM
AFAIK document.write(mes[0]) will work, since escape codes are only necessary when you hard-code the string. Have you tried?

shmoove

dallen24
03-13-2004, 07:50 PM
Oh it does work. I'm just worried it won't work all the time or for all browsers.

Actually, the mes[0] ends up in a document.all['id'].innerHTML=mes[0]. You said converting '/' to '\/' is only needed for hardcoding your string. Could you explain?

shmoove
03-14-2004, 08:42 AM
Well, basically, stuff like that (escape sequences in strings) is only important when the software (the ASP engine in this case) is parsing the code, once it is stored in a variable there is no trace of the escape sequence, and the appropiate character (it's ASCII code) is already stored in the memory that relates to that variable.
There is no reason at all why it shouldn't work on any browser.

shmoove



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum