2012-02-23 21 views
0

こんにちはこれは私のコードの一部です。 配列内の各イメージを別々のURLにリンクする必要があります。 内部からでもこれを行うことは可能ですか dataArrClothes.push(["imagename.jpg","<a href="someurl"></a> "Description"]); 何か助けていただければ幸いです。あなたはその後、持っているあなたは、おそらくこれはあなたに以下を与えるだろうJavascript、配列要素を別のURLにリンクする方法

var dataArrClothes = []; 

dataArrClothes.push({ img_src: "imagename.jpg", description: "Description"}); 

dataArrClothes.push({ img_src: "imagename.jpg", description: "Description"}); 

..オブジェクトの配列の代わりに、配列の配列を使用したい

var dataArrClothes = new Array(); 
dataArrClothes.push(["imagename.jpg", "Description"]); 
dataArrClothes.push(["imagename.jpg", "Description"]); 
+0

、私はあなたが望むものを理解していませんでした。あなたはもっと明確になりますか? –

+0

「画像を別のURLにリンクする」ということをより詳しく説明できますか? –

答えて

2

...

dataArrClothes[0].img_src; // "imagename.jpg" 

dataArrClothes[0].description: // "Description" 

img_srcおよびdescriptionプロパティを持つオブジェクトの配列。あなたのような、オブジェクトリテラルを使用することができます

0

:ごめんなさい

dataArrClothes.push(
    {ImageUrl: 'imagename.jpg', 
    Description: 'Your description here' 
    }); 
関連する問題