[英]why Undefined problem in alertbox javascript occur when i click
我正在嘗試這段代碼,我也嘗試了其他方法,但仍然會出現這個問題,所以請記住 vs code 是我的編輯器。
<head>
<title>Document</title>
</head>
<body>
<input type="number" id="name" />
<button onclick="fun()">click me</button>
<script>
function fun() {
var fir = Number(document.getElementById("name").Value);
alert(fir);
}
</script>
</body>
嘗試以下評論中建議的value
,
<head>
<title>Document</title>
</head>
<body>
<input type="number" id="name" />
<button onclick="fun()">click me</button>
<script>
function fun() {
var fir = Number(document.getElementById("name").value);
alert(fir);
}
</script>
</body>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.