0
我有點麻煩,寫文本的唯一行是document.write(「房間是」+牆+「平方英尺」+ BR);在我進入提示窗口之後,沒有別的東西出現,我是否做錯了什麼?Javascript代碼document.write
<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
var BR = "<br />";
var galPaint = 100;
var galNeeded;
var length;
var width;
length = prompt("enter legnth of room in inches");
width = prompt("enter width of room in inches");
var perimeter = (Number(length)+Number(width))*2;
var walls = (perimeter*96)/Math.pow(12,2);
document.write("The room is"+ walls +"square feet"+ BR);
var doors;
var windows;
doors = prompt("Enter Number of doors");
windows = prompt("enter number of windows");
var sqfWindow = (Number(doors)*14);
var sqftDoor = (Number(windows)*20);
var totalSqft = (walls-(sqftWindow + sqftDoor));
galNeeded = (totalSqft/galpaint);
document.write("You need" + galNeeded + "gallons of paint" + BR);
</script>
</body>
</html>
注意:'document.write'永遠不會(幾乎沒有)好的做法 –