admin管理员组文章数量:1355542
When my sql server SP returning string with new line character and in my jsp I pass it to script function and display it in alert box it throws :
function sample(notes){
alert(notes);
}
Error:
script1015: unterminated string constant
I can handle it in SP like
REPLACE(BDT.Notes , CHAR(13) + CHAR(10), ''<br/>'' ) as Notes
But is there any way to handle it in script?
When my sql server SP returning string with new line character and in my jsp I pass it to script function and display it in alert box it throws :
function sample(notes){
alert(notes);
}
Error:
script1015: unterminated string constant
I can handle it in SP like
REPLACE(BDT.Notes , CHAR(13) + CHAR(10), ''<br/>'' ) as Notes
But is there any way to handle it in script?
Share Improve this question edited Jun 14, 2013 at 11:51 mit asked Jun 14, 2013 at 11:44 mitmit 4,80715 gold badges44 silver badges71 bronze badges 2- You can't handle malformed language constructs within a language as it not valid language in that language. Fix up the strings in the jsp before you output them? – Alex K. Commented Jun 14, 2013 at 11:49
- @AlexK. Can you give sample code? – mit Commented Jun 14, 2013 at 11:53
1 Answer
Reset to default 5try below
someText = someText.replace(/(\r\n|\n|\r)/gm,"");
see link http://www.textfixer./tutorials/javascript-line-breaks.php
本文标签: javahandle unterminated string constant in javascriptStack Overflow
版权声明:本文标题:java - handle unterminated string constant in javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744029213a2578599.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论