我正在研究谷歌日历 API。每当我创建任何事件并输入具有新行的该事件的描述时,它都会给我如下错误:
“未终止的字符串常量”。
我将事件描述从 Java 传递到 Javascript。那么如何格式化具有新行的字符串呢?
我的代码是:
var EventDescription='<% =eventDetails.getEventDescription(eventIndex)%>'
eventDetails -java class
getEventDEscription -Method to get the Description of event.
eventIndex - no of the event whoes Description is needed .
否则它工作正常。只有在描述有新行时才会出错。