未终止的字符串文字错误 [英] unterminated string literal error
问题描述
< script type =text / javascript>
jQuery(document).ready(function(){
jQuery('head')。append('< script type =text / javascriptsrc =../ wp-includes / js /thickbox.js\"></script>');
});
< / script>
我得到了一个未终止的字符串字面值的错误。
这个问题来自您的代码包含< / script>
的事实。这会导致浏览器认为您正在尽早终止您的< script>
标签。如果您将您的代码更改为以下代码,则该代码可以正常工作:
< script type =text / javascript>
jQuery(document).ready(function(){
jQuery('head')。append('< script type =text / javascriptsrc =../ wp-includes / js /thickbox.js\"></'+'script>');
});
< / script>
正如您所看到的,上面的代码打破了 I have placed the below code inside of the tag. I got an error of "unterminated string literal". The problem is coming from the fact that your code includes As you can see, the above code breaks the 这篇关于未终止的字符串文字错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!< / script> 放入
'< /'+'script>'
中,这样浏览器就不会将它解析为结束标记。 / p> <script type="text/javascript">
jQuery(document).ready(function(){
jQuery('head').append('<script type="text/javascript" src="../wp-includes/js/thickbox.js"></script>');
});
</script>
</script>
in it. This is causing the browser to think that you're terminating your <script>
tag early. If you change your code to the following, it will work:<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('head').append('<script type="text/javascript" src="../wp-includes/js/thickbox.js"></' + 'script>');
});
</script>
</script>
in your string into '</' + 'script>'
, so that the browser doesn't parse it as a closing tag.