Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jun 2002
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Response.Write()

    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>'

  • #2
    Regular Coder
    Join Date
    Dec 2003
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts
    AFAIK document.write(mes[0]) will work, since escape codes are only necessary when you hard-code the string. Have you tried?

    shmoove

  • #3
    New Coder
    Join Date
    Jun 2002
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #4
    Regular Coder
    Join Date
    Dec 2003
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •