[英]Javascript: unterminated string literal
Something weird and I don't understand. 奇怪的东西,我不明白。
My code: 我的代码:
$("#loadbtn").click(function(e) {
$html = '<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script> dsfdsf';
$("#content").html($html);
});
When I run the page on browser, it returns error saying SyntaxError: unterminated string literal
. 当我在浏览器上运行页面时,它返回错误,说出
SyntaxError: unterminated string literal
。 I can't see anything wrong. 我看不出有什么不对劲。 Can you tell me what's wrong there?
你能告诉我那里有什么问题吗?
Thank you. 谢谢。
</script>
总是在javascript中引发奇怪的错误,因为它实际上关闭了当前脚本,即使在字符串中,也要尝试将其拆分
$html = '<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></scr'+'ipt> dsfdsf';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.