gpt4 book ai didi

javascript 格式错误

转载 作者:行者123 更新时间:2023-11-30 18:42:29 25 4
gpt4 key购买 nike

 var liHtml = "<div class='slide'><a href='"+itemLink+"' target='_blank' border='0'><img width='420' height='220'  src='" + imageLink +"'/></a>" + "<div class="caption" style="bottom:'0'"><p>" + title + "</p></div></div>";

firebug 给我这个错误

missing ; before statement
[Break On This Error] var liHtml = "<div class='slide'><...'"><p>" + title + "</p></div></div>";

我错过了什么。上面的代码应该如下所示

<div class="slide">
<a href="photos/jliba/4665625073/" title="145.365 - Happy Bokeh Thursday" target="_blank"><img src="img/slide-1.jpg" width="570" height="270" alt="Slide 1"></a>
<div class="caption" style="bottom:0">
<p>Happy Bokeh Thursday!</p>
</div>
</div>

最佳答案

替换

"<div class="caption" style="bottom:'0'"><p>"在你的连接中

"<div class=\"caption\" style=\"bottom:'0'\"><p>" 

即:

var liHtml = "<div class='slide'><a href='"+itemLink+"' target='_blank' border='0'><img width='420' height='220'  src='" + imageLink +"'/></a>" + "<div class=\"caption\" style=\"bottom:'0'\"><p>" + title + "</p></div></div>"; 

关于javascript 格式错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6445784/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com