<!DOCTYPE html>
<html>
<body>
<p>Click the button to display a random number between 1 and 10.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = Math.floor((Math.random() * 10) + 1);
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
나는 dreamweaver에서 html 파일을 만들었지 만 오류가있어서 오류를 찾지 못했습니다 !!!자바 스크립트에서 임의의 숫자를 생성
무엇이 오류로 들겠습니까? 코드는 잘 작동합니다. – RhapX
오류가 없습니다 – Theyouthis
코드가 완벽합니다 .. 오류가 없습니다. 있을 경우 오류를 게시 할 수 있습니까? –