View Full Version : unterminated string constant java error

07-14-2006, 05:38 PM
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???


07-14-2006, 06:03 PM
If there are line breaks in the data entries, these need to be converted to either:




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:


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