Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JavaScript error : Unterminated string constant

Status
Not open for further replies.

TTMTech

Programmer
Feb 5, 2003
29
0
0
US
Hi All:


<textarea name=&quot;notes&quot; OnKeyPress=&quot;ChekSizeOfNotes()&quot; cols=52 maxlength=1000 rows=5 > </textarea>


JavaScript:

{...


var str= str+&quot;&solder_type=&quot;+'<tmpl_var prnsolder_type>'+&quot;&finish_type=&quot;+'<tmpl_var prnfinish_type>'+&quot;&impedence_tolerance=&quot;+'<tmpl_var prnimpedence_tolerance>'+&quot;&test_type=&quot;+'<tmpl_var prntest_type>'+&quot;¬es=&quot;+'<tmpl_var notes>';

.......

}

above is reload by perl script.

When I entered few lines and if I hit ENTER KEY at end and press save button then it pass to JavaScript ,it gives Unterminated string constant error.

If anybody can help me how to take care of this error. Thanks in advance.
 
Can you do a view source on the page and post it
here --or--

You might want to start another thread in the
JavaScript forum

But the page source will help us find your problem.

2b||!2b
 
Hi Lrnmore

Thanks for your reply. Here, is viewsource.I don't know in perl how to replace carriage return with \n.

str=str+&quot;&gold_tips=&quot;+''+&quot;&other_customer_name=&quot;+''+&quot;&other_part_number=&quot;+''+&quot;&MaxforMin=&quot;+'';
// alert(str);
str= str+&quot;&solder_type=&quot;+'Other'+&quot;&finish_type=&quot;+'Other'+&quot;&impedence_tolerance=&quot;+'Other'+&quot;&test_type=&quot;+'Other'+&quot;&notes=&quot;+'This is a new customer.
This is a test data.
This is another testing.

';


var newWindow =window.open(str,'window2', 'resizable=yes,width=750,height=500,scrollbars=yes,top=35,left=15');


Thanks.
TTMTECH
 
Escape your periods:
And watch out, I've heard leaving spaces in the
window.open parameters is no good.

function shwstr() {
var str = &quot;&quot;;
str = str+ &quot;&gold_tips=&quot;+''+
&quot;&other_customer_name=&quot;+''+&quot;&other_part_number=&quot;+''+&quot;&MaxforMin=&quot;+'';
str= str+&quot;&solder_type=&quot;+'Other'+&quot;&finish_type=&quot;+'Other'+&quot;&impedence_tolerance=&quot;+'Other'+&quot;&test_type=&quot;+'Other'+&quot;¬es=&quot;+
'This is a new customer\.This is a test data\.This is another testing.';
alert(str);

}

2b||!2b
 
HI Lrnmore,

You are right.But how to do that in perl variable.

Source code:

var str= str+&quot;&solder_type=&quot;+'<tmpl_var prnsolder_type>'+&quot;&finish_type=&quot;+'<tmpl_var prnfinish_type>'+&quot;&impedence_tolerance=&quot;+'<tmpl_var prnimpedence_tolerance>'+&quot;&test_type=&quot;+'<tmpl_var prntest_type>'+&quot;notes=&quot;+'<tmpl_var notes>';

I mean How to do in perl variable :

$notes = 'This is a new customer\.This is a test data\.This is another testing.';

Thanks,
TTMTECH

 
HI Lrnmore,

You are right.But how to do that in perl variable.

Source code:

var str= str+&quot;&solder_type=&quot;+'<tmpl_var prnsolder_type>'+&quot;&finish_type=&quot;+'<tmpl_var prnfinish_type>'+&quot;&impedence_tolerance=&quot;+'<tmpl_var prnimpedence_tolerance>'+&quot;&test_type=&quot;+'<tmpl_var prntest_type>'+&quot;&notes=&quot;+'<tmpl_var notes>';

I mean How to do in perl variable :

$notes = 'This is a new customer\.This is a test data\.This is another testing.';

Thanks,
TTMTECH

 
Well try escaping the slashes for perl:


$notes = 'This is a new customer\\\.This is a test data\\\.This is another testing\\\.';

2b||!2b
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top