我是编程新手,正在尝试制作一个简单的计算器。在编写了一些代码之后,我意识到我的 JavaScript 代码没有显示在我的 HTML 页面上。请告诉我发生了什么事。
这是我的 HTML 代码:
<!DOCTYPE html>
<html>
<head>
<title>
Simple GUI Calculator
</title>
<script src="Calculator.js"></script>
</head>
<body>
</body>
</html>
这是我的 JavaScript 代码:
strokeWeight(1);
var x = 10;
var y = 140;
var xDiff = 113;
var yDiff =70;
var buttonSize = 40;
fill(95, 95, 95);
rect(1, 1, 398, 400);
fill(255, 255, 255);
rect(10, 10, 380, 100);
fill(5, 4, 4);
rect(x, y, buttonSize, buttonSize);
rect(x + xDiff, y, buttonSize, buttonSize);
rect(x + 2 * xDiff, y, buttonSize, buttonSize);
rect(x + 3 * xDiff, y, buttonSize, buttonSize);
rect(x, y + yDiff, buttonSize, buttonSize);
rect(x + xDiff, y + yDiff, buttonSize, buttonSize);
rect(x + 2 * xDiff, y + yDiff, buttonSize, buttonSize);
rect(x + 3 * xDiff, y + yDiff, buttonSize, buttonSize);
rect(x, y + 2 * yDiff, buttonSize, buttonSize);
rect(x + xDiff, y + 2 * yDiff, buttonSize, buttonSize);
rect(x + 2 * xDiff, y + 2 * yDiff, buttonSize, buttonSize);
rect(x + 3 * xDiff, y + 2 * yDiff, buttonSize, buttonSize);
rect(x, y + 3 * yDiff, buttonSize, buttonSize);
rect(x + xDiff, y + 3 * yDiff, buttonSize, buttonSize);
rect(x + 2 * xDiff, y + 3 * yDiff, buttonSize, buttonSize);
rect(x + 2 * xDiff + 90, y + 3 * yDiff, buttonSize + 23, buttonSize);