Javascript数组(对应)

Javascript arrays (corresponding)

本文关键字:对应 数组 Javascript      更新时间:2023-09-26

我在理解这个代码中要写的内容时遇到了问题

(很抱歉,它是德语的,这是JavaScript图像的对应数组。)

function namenZuBildern(){ 
   var bilder = new Array( "000227", "000228",
   "000229", "000231", "000233", "000235", "000237", "000238", "000239", 
   "000241", "000242", "000245", "000247", "000248", "000249", "000250",
   "000252", "000253", "000254", "000258", "000259", "000261", "000262" ) ; 
   var index = document.getElementById('einform').person.selectedIndex;
   document.images[0].src="#" + bilder[index] + ".jpg"; 
}  

就像newAray()中的所有这些数字一样。照片的位置?

我知道我必须在里写id

document.getElementById('...').person.selectedIndex;    

但是呢document.images[0].src="#"+bilder[index]+".jpg";当我有4张照片时,为什么是[0]

请帮助

由于bilder数组用于设置图像的src值,我敢打赌这些值对应于文件名