簡體   English   中英

JSON多行圖像代碼

[英]JSON multilined images code

我需要在json中存儲多行img src代碼,以便稍后在jquery中使用,但是語法有問題。 所以如果我只存儲一行

{
        "captionthree":

        "<img class=\"smallicon\" src=\"logos/3dmax.png\" height=\"20px\" width=\"20px\" title=\"3D Stuio Max\">"

}

有用。

但是,如果我輸入多行,則不會:

{
        "captionthree":

        "<img class=\"smallicon\" src=\"logos/3dmax.png\" height=\"20px\" width=\"20px\" title=\"3D Stuio Max\">
        <img class=\"smallicon\" src=\"logos/zbrush.png\" height=\"20px\" width=\"20px\" title=\"ZBrush\">
        <img class=\"smallicon\" src=\"logos/topogun.png\" height=\"20px\" width=\"20px\" title=\"Topogun\">
        <img class=\"smallicon\" src=\"logos/vray.png\" height=\"20px\" width=\"20px\" title=\"V-Ray\">
        <img class=\"smallicon\" src=\"logos/mari.png\" height=\"20px\" width=\"20px\" title=\"MARI Foundry\">
        <img class=\"smallicon\" src=\"logos/photoshop.png\" height=\"20px\" width=\"20px\" title=\"Adobe Photoshop\">",

}

這是我將其插入的jquery行:

$('#captionthree').html(database[globalswitchNumber].captionthree);

在每個圖像標簽之前刪除新行。 由於存在新行,因此無法將其作為一個字符串處理。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM