Unclosed string error when linting

This question already has an answer here: Creating multiline strings in JavaScript 34 answers 做这样的事情$this.append( '<a href="' + slideLink + '"' + slideTarget + '> <span class="slide-time-date"></span> <div class="slide-overlay-text slide-overlay-text-mobile"' + slideColour + '> <span>' + slideOverlaytext + '</span&g

发生短路时未闭合的字符串错误

这个问题在这里已经有了答案: 在JavaScript中创建多行字符串34个答案 做这样的事情$this.append( '<a href="' + slideLink + '"' + slideTarget + '> <span class="slide-time-date"></span> <div class="slide-overlay-text slide-overlay-text-mobile"' + slideColour + '> <span>' + slideOverlaytext + '</span> </div> <

String that contains line breaks

Possible Duplicate: How to create multiline strings I have a lot of strings that I want to put in variables, but there is line breaks that aren't accepted. Firefox says "Unterminated string literal" when I write : var a="foo bar"; Is there a way to write my strings without removing the line breaks manually? If this is not acceptable: var a="foo" + "bar"; Or as @minitech

包含换行符的字符串

可能重复: 如何创建多行字符串 我有很多字符串,我想把变量,但是有不被接受的换行符。 我写的时候Firefox会说“Unterminated string literal” var a="foo bar"; 有没有办法在不手动删除换行符的情况下编写我的字符串? 如果这是不可接受的: var a="foo" + "bar"; 或者@minitech(新mod)建议: var a="foo bar"; 那么答案是否定的。 该脚本是否由Web服务器动态生成? 如果是这样,该Web服务器将需要将换行

Trying to change HTML with Jquery

This question already has an answer here: Creating multiline strings in JavaScript 34 answers 尝试在字符串输入超出较新行时正确地concatenate字符串, $('.typehidden .controls').html( "<select name='myName' id='myId'>" + "<option value=''>-</option>" + "<option value='A'>A</option>" + "<option value='B'>B</option>" + "<

试图用Jquery改变HTML

这个问题在这里已经有了答案: 在JavaScript中创建多行字符串34个答案 尝试在字符串输入超出较新行时正确地concatenate字符串, $('.typehidden .controls').html( "<select name='myName' id='myId'>" + "<option value=''>-</option>" + "<option value='A'>A</option>" + "<option value='B'>B</option>" + "</select>" ); 您可以使用创

copy and paste a string block to JS code

Possible Duplicate: How to create multiline strings is it a way to assign following text to a variable more easily: line 1 line 2 line 3 instead of: t="line 1nline 2nline 3"; I want copy and paste some text to test some RexExt on it without modifying every ones. You may try this site. Not automatic but pretty faster than manual

将一个字符串块复制并粘贴到JS代码中

可能重复: 如何创建多行字符串 是否可以更轻松地将以下文本分配给变量: line 1 line 2 line 3 代替: t="line 1nline 2nline 3"; 我想复制并粘贴一些文本来测试它的一些RexExt而不修改每一个。 你可以试试这个网站。 不是自动的,但比手动快得多

Why can't I store multi line values into a JavaScript literal?

Possible Duplicates: a more graceful multi-line javascript string method Multiline strings in Javascript window.lastSavedContents = "test tester"; That's my JavaScript Code. I get a firebug error saying: unterminated string literal [Break On This Error] window.lastSavedContents = "test Indeed; that's simply not valid syntax. Use "n" to represent a newline: wi

为什么我不能将多行值存储到JavaScript文字中?

可能重复: 一个更优雅的多行javascript字符串方法 Javascript中的多行字符串 window.lastSavedContents = "test tester"; 这是我的JavaScript代码。 我得到一个萤火虫错误说: 未终止的字符串文字[Break On This Error] window.lastSavedContents =“test 确实; 这根本就是无效的语法。 使用“ n”代表换行符: window.lastSavedContents = "testnntester"; 如果要在JavaScript值中标记新行,则不要在其中放置换行

Concatenate strings on multiple lines in JavaScript

This question already has an answer here: Creating multiline strings in JavaScript 34 answers Try: var css = '.myclass { text-align: center .... };' + '.myclass { something else .... };'; Or: var css = [ '.myclass { text-align: center .... };', '.myclass { something else .... };' ].join("n"); Yes, if you are fine with only evergreen browsers you

在JavaScript中多行连接字符串

这个问题在这里已经有了答案: 在JavaScript中创建多行字符串34个答案 尝试: var css = '.myclass { text-align: center .... };' + '.myclass { something else .... };'; 要么: var css = [ '.myclass { text-align: center .... };', '.myclass { something else .... };' ].join("n"); 是的,如果你只用常绿的浏览器罚款,你可以使用新的`报价: var css = ` .multipl

Alternative of triple quoted string in Javascript as Python has

This question already has an answer here: Creating multiline strings in JavaScript 34 answers When python stores the string like that, it's strictly a list of characters and the triple quotes tell it not to modify anything. For your html, if I understand right you probably have the slightly different problem that you want to automatically add all the html tags like <p>...</p>

Python中使用三重引号字符串的替代方法

这个问题在这里已经有了答案: 在JavaScript中创建多行字符串34个答案 当python存储这样的字符串时,它严格地是一个字符列表,而三重引号告诉它不要修改任何东西。 对于你的html,如果我理解正确,你可能会遇到稍微不同的问题,你想自动添加所有的html标签,如<p>...</p>在你的段落中和周围? 也许更合适的方式来考虑这样做会使用一个更简单的标记语言,如减价,然后可以转换为完全形成的HTML。 实际上,这

Defining a long string with javascript

This question already has an answer here: Creating multiline strings in JavaScript 34 answers 只要把在每行的最后仍然在字符串中str = " The quick brown // <--- fox jumped over the log."; Easiest thing to do is to add a at the end of the lines: function test_str() { str = " The quick brown fox jumped over the log."; alert(str); } jsFiddle example 尝试这个: str = " the quick br

用javascript定义一个长字符串

这个问题在这里已经有了答案: 在JavaScript中创建多行字符串34个答案 只要把在每行的最后仍然在字符串中str = " The quick brown // <--- fox jumped over the log."; 最简单的方法是在行尾添加一个 : function test_str() { str = " The quick brown fox jumped over the log."; alert(str); } jsFiddle例子 尝试这个: str = " the quick brown foxrn" + "fox jumped over the lazy dog";

Set a string of HTML equal to a variable in javascript

This question already has an answer here: Creating multiline strings in JavaScript 34 answers If you want to include line breaks in your actual code to make it easier to read, you're going to need to escape each one with a backslash, eg: var new_comment = ' <li class="photobooth-comment"> <span class="username"> <a href="#">You</a> <

在javascript中设置一个等于变量的HTML字符串

这个问题在这里已经有了答案: 在JavaScript中创建多行字符串34个答案 如果你想在你的实际代码中加入换行符以便于阅读,你需要用反斜杠来转义每一行,例如: var new_comment = ' <li class="photobooth-comment"> <span class="username"> <a href="#">You</a> </span> <span class="comment-text"> ' + text + ' </span>

What is the best way to have long string literals in Javascript?

Possible Duplicate: Multiline strings in Javascript In Ruby you can do something like this temp = <<-SQLCODE select * from users SQLCODE This way you have very long string literals in your code without have to escape lots of characters. Is there something similar in JavaScript? Currently I have javascript code like this, and its driving me nuts... new Element.update(lightbox_i

在Javascript中使用长字符串的最佳方式是什么?

可能重复: Javascript中的多行字符串 在Ruby中,你可以做这样的事情 temp = << - SQLCODE select * from用户SQLCODE 这样你的代码中有很长的字符串文字,而不必逃避大量的字符。 JavaScript中有类似的东西吗? 目前我有这样的JavaScript代码,它使我疯狂...... new Element.update(lightbox_id, " <div id='overlay' class='overlay' > </div> <div id='lightbox' class='l