[英]Loading a blank page when opened
我正在查看一些簡單的Javascript,有人可以幫助您找出問題所在,我是JS的新手,所以我確定這很簡單,我已經錯過了,但是當我加載頁面時,它保持空白並且什么都沒有負載?
任何幫助深表感謝。
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<script>
var numx = prompt("enter your first number");
var numy = prompt("enter your second number");
var oper = prompt("enter one of the following operations you would like done to your two numbers, +, -, /, *");
var answer = 0;
if(oper == "+")
{
answer = (numx + numy);
}
else if(oper == "-")
{
answer = (numx - numy);
}
else if(oper == "*")
{
answer = (numx * numy);
}
else (oper == "/")
{
answer = (numx / numy);
}
document.write("<p>the answer is " + answer "</p>");
</script>
</body>
</html>
document.write("<p>the answer is " + answer + "</p>");
這是一個小提琴,它寫入現有文檔元素而不是document.write。 https://jsfiddle.net/49yuod7w/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.