Results 1 to 2 of 2

Thread: unterminated string constant java error

  1. #1
    Join Date
    Jul 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question unterminated string constant java error

    I'm trying to redirect text into a ddrivetip from a sql server database using the following method:


    InsertString = RT(LEFT(RS("longdesc"),700))
    InsertString = REPLACE( InsertString, "/", "-")
    InsertString = REPLACE( InsertString, "%", "p")
    ToolString = "<table border=1 cellspacing=0>"
    If RS("picture1") <> "" Then
    ToolString = ToolString & "<tr><td><IMG SRC='img/" & RS("picture1") & "'><BR></td></tr>"
    end if
    ToolString = ToolString & "<tr><td><b><font face=Arial size=1>"
    ToolString = ToolString & InsertString & "</font></b></TD></TR></TABLE>"
    ToolString = REPLACE( ToolString, "'", "\'")
    'ToolString = REPLACE( ToolString, "/", "-")
    Response.Write "<INPUT TYPE=""checkbox"" NAME=""partCompare"" "
    Response.Write "VALUE=""" & RS("part_id") & """>&nbsp;&nbsp;"
    Response.Write "<A HREF=""products.asp?ID=" & RS("part_id") &""" onMouseover=""ddrivetip('"& ToolString &"' ,'white',

    300)""; onMouseout=""hideddrivetip()"" BORDER=""0"">" & sProd & "</A></TD>"



    The end result of the script generates several java errors on the internet explorer browser page. Some of the data that is being pulled in to the toolstring is being truncated due to the large amount of data. Most of the tooltips work, just a few for each page don't show up, and I get a java error "unterminated string constant". What am I doing wrong? I've already replace the tick marks with \'. I've just been guessing as to what other characters need to be replaced???

    HELP..

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    If there are line breaks in the data entries, these need to be converted to either:

    \n

    or:

    '+'

    The first substitution will preserve the line break but not in an HTML rendering of it on a page unless the entire string is enclosed in the <pre></pre> HTML tags, the second will remove the line break. You could also use:

    <br>

    as a substitute to get the line break to render in HTML.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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