我需要回答如下问题:
例如,可以在电子商务网站上设置一系列产品,如下所示。
var products = ["Printer","Tablet","Router"];
(i)设置一个数组以包含上面显示的项目,以及您选择的一些额外内容。
<!DOCTYPE html>
<html>
<body>
<p id="How to set up and Array with items in HTML"></p>
<script>
var Items = ["Printer", "Tablet", "Router","Headset","Keyboard","Mouse"];
document.getElementById("demo").innerHTML = Items;
</script>
</body>
</html>
答案 0 :(得分:0)
您将id
设置为"How to set up and Array with items in HTML"
而不是"demo"
:
<html>
<body>
<p id="demo"></p>
<script>
var Items = ["Printer", "Tablet", "Router","Headset","Keyboard","Mouse"];
document.getElementById("demo").innerHTML = Items;
</script>
</body>
</html>
&#13;