我的随机图像不会显示。我甚至通过一个html验证器运行它仍然无法找到错误。
function showImg() {
/*
The showImg() function displays a random image from the 0.png through 9.png files. The random image is designed to thwart hackers attemting to enter the library records database by requiring visual confirmation.
*/
var imgNumber = randomInteger(9):// Return a random number from 0 to 9
document.write ("<img src='" + imgNumber + ".png' alt=' ' />");
}
</script>
<script type="text/javascript">
showImg();
showImg();
showImg();
showImg();
showImg();
</script>
答案 0 :(得分:1)
将# Maximum number of validators/replicas we expect in the network
# Keep the "N" in quotes, or it will be interpreted as "false".
"N": 4
调整为
showImg
对于function showImg() {
var imgNumber = randomInteger(9);// Return a random number from 0 to 9
document.body.innerHTML += "<img src=" + imgNumber + ".png alt='' />";
}
功能,您可以使用
randomInteger
答案 1 :(得分:0)
您的图片是否存储在与您呼叫的网页相同的文件夹中?如果它们在子文件夹中,那么您显然需要在代码中指定路径 - 相对路径或绝对路径。