谁能帮帮我?我正在尝试调用 JS 文件,但无法正常工作。我是新手,真的不知道为什么。
<html>
<head>
<title>Stack</title>
<meta charset=utf-8>
<script>
var fruits = new array();
fruits[0] = "Apple";
fruits[1] = "Strawberry";
fruits[2] = "Orange";
for(i=0; i<3; i++){
document.write(fruits[i]+"</br>");
}
</script>
</head>
<body>
<div>JavaScript</div>
</body>
</html>
最佳答案
数组而不是数组
<html>
<head>
<title>Stack</title>
<meta charset=utf-8>
<script>
var fruits = new Array();
fruits[0] = "Apple";
fruits[1] = "Strawberry";
fruits[2] = "Orange";
for(i=0; i<3; i++){
document.write(fruits[i]+"</br>");
}
</script>
</head>
<body>
<div>JavaScript</div>
</body>
</html>
关于javascript - 我的 html 没有调用 JavaScript 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42729644/