0

我有一个程序可以从有关鸟类的数据集中获取信息,它将根据生成的随机数显示随机鸟类及其信息除了图像部分之外,我已将所有内容都记录下来

我尝试使用

setImageURL("birdInfoImage",birdImage[index]);

在函数中但出现错误说“setImageURL() url 参数值(未定义)不是字符串”

编辑:这是在 code.org 上的家庭作业。图片应取自网站“鸟的形象”栏目中的数据集

var birdImage = getColumn("100 Birds of the World", "Image of Bird");

然后我在函数中使用鸟图像来使用数据集中图像的 URL 并将该 URL 设置为图像

 onEvent("initiateButton","click",function(){
  var index = getNumber("randomNumberOutput");
  setText("birdInfoName", reducedBirdList[index]);
  setText("birdInfoScientificName", reducedBirdList[index]);
  setText("birdInfoColor", PrimaryColor[index]);
  setText("birdInfoDiet", birdDiet[index]);
  setImageURL("birdInfoImage",birdImage[index]);

希望有帮助

4

0 回答 0