document.write输出变量报错

请教这段代码报错Uncaught SyntaxError: missing ) after argument list,但是document.write的()是完整的,错在哪里,谢谢

          <script>

            var a="{$content_images}";

            var b=a.split("|");

            for (var i = b.length - 1; i >= 0; i--) {

              document.write("<li><img src=""+b[i]+""></li>");

            };                                  

          </script>


LEATH
浏览 608回答 1
1回答

慕村225694

引号写错了&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var a="{$content_images}";&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var b=a.split("|");&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (var i = b.length - 1; i >= 0; i--) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.write('<li><img src=' + b[i] + '></li>');&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; };&nbsp; &nbsp; &nbsp;&nbsp;
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript