1
我有以下對象的數據:如何打印此javascript對象?
var js_images = {
"newborn_set01_01.jpg":{"filename":"newborn_set01_01.jpg","title":"First Pic","description":"First description..."},
"newborn_set01_02.jpg":{"filename":"newborn_set01_02.jpg","title":"Second Pic","description":"Second description"},
"newborn_set01_03.jpg":{"filename":"newborn_set01_03.jpg","title":"Third Pic","description":"Third description"}
};
我怎麼會做如創建一個警報,以顯示newborn_set01_03.jpg
描述簡單的東西?
這顯然不工作:
alert(js_images.newborn_set01_03.jpg.description);
的.JPG newborn_set01_03的一部分.jpg可能會推掉程序....呃,實際上是「。」 .jpg – robert