javascript问题,大虾们看看这段代码问题处在哪里!

来源:百度知道 编辑:UC知道 时间:2024/06/07 12:21:35
<scrīpt>
document.write(<img src="img/+parseInt(Math.random()*(5))
+.gif"height="40" width="50">)
</scrīpt>

这个是随机换图片,老是弹出语法不对,,,是从网上看了的,不知道问题处在哪里!!!
<scrīpt>
document.write(<img src="img/+parseInt(Math.random()*(5))
+.gif"height="40" width="50">)
</scrīpt>
这句是没有错的!

document.write()里面要有单引号或双引号

<script>
document.write('<img src=img/'+parseInt(Math.random()*(5))
+'.gif height=40 width=50>')
</script>

肯定是错的!

<scrīpt>
document.write(<img src="img/"+parseInt(Math.random()*(5))
+".gif"height="40" width="50">)
</scrīpt>

<script>
document.write(<img src="img/"+parseInt(Math.random()*(5))
+".gif"height="40" width="50">)
</script>

src="img/+parseInt(Math.random()*(5)) +.gif"语句不对