#python #anaconda #jupyter-notebook #visual-code #html #css #javascript #http

제목html Alert 예제 질문입니다2021-11-27 15:08
작성자

사용자의 입력값을 받는 id의 type을 number로 지정을 해준다고 적었는데

왜 text도 입력이 되는지 잘 모르겠습니다ㅠㅠ

<head>

<title>Alert Page</title>

<script>

function myAlertMath()

{

var userNumber = document.getElementById("mathInput").value;

alert("Your number X 5 is " + userNumber*5);

}

</script>

</head>


<body>

<p> JavaScript Alert Tests.</p>

<button onclick="alert('The test worked');">Alert Test</button>

<input id="mathInput" type="number"/> 

<button onclick="myAlertMath();"> Multiply X 5</button>

</body>

댓글
이전[re]input함수 prompt2021-11-29
다음[re]html Alert 예제 질문입니다2021-11-29