unterminated string constant error

unterminated string constant in javascript

Page 1 of 1

1 Replies - 3191 Views - Last Post: 06 October 2010 - 10:53 AM

#1 sutr_kam  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 15-February 09

unterminated string constant error

Posted 06 October 2010 - 10:39 AM

Hi,
I have code like this
<script type='text/javascript'>
<%
String contactReasonHold = (String)request.getAttribute("CReasonHold");
%>
var crh = "<%= contactReasonHold %>"; 


if the 'contactReasonHold' value is single line then there is no problem

if it is more than 1 line,
then iam getting javascript error stated above

please help me...

This post has been edited by sutr_kam: 06 October 2010 - 10:40 AM


Is This A Good Question/Topic? 0
  • +

Replies To: unterminated string constant error

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3577
  • View blog
  • Posts: 10,442
  • Joined: 08-June 10

Re: unterminated string constant error

Posted 06 October 2010 - 10:53 AM

your best bet is to pass the string linewise. Javascript doesn’t support multiline strings (unless you escape the line feeds)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1