- JScript code
<script type="text/javascript"> var data = { "s1.jpg": ["1.jpg", "Lili", "168", "nurse"], "s2.jpg": ["2.jpg", "Smith", "170", "Teacher"] }; function showSmallDiv() { var imgDiv = document.getElementById("imgDiv"); for (var itme in data) { alert(item); } } </script>
------解决方案--------------------------------------------------------
本来data就是一个object, 它有名为s1.jpg的字段,值是一个数组,还有一个名为s2.jpg的字段,也是一个数组
------解决方案--------------------------------------------------------
- JScript code
var data = { "s1.jpg": ["1.jpg", "Lili", "168", "nurse"], "s2.jpg": ["2.jpg", "Smith", "170", "Teacher"] }; for (var item in data) { alert(item); }