무작위로 단어를 생성 한 페이지를 만들려고 노력하고 있습니다.반응이 무작위로 생성 된 요소
<head>
<style type='text/css'>
.box {
height: auto;
position: absolute;
width: auto;
}
</style>
<script type='text/javascript'>
function setDivPos() {
for (i=1; i<=2; i++) {
var x = Math.floor(Math.random()*1130);
var y = Math.floor(Math.random()*722);
document.getElementById('div'+i).style.left = x + 'px';
document.getElementById('div'+i).style.top = y + 'px';
}
</head>
<body onload='setDivPos();'>
<div id='div1' class='box'>ARCHIVE</div>
<div id='div2' class='box'>PERSPECTIVE</div>
</div>
</body>
전체 웹 사이트는이 알고리즘을 기반으로합니다. 이 무작위로 배치 된 객체를 1130x722 영역 내에서 어떻게 만들 수 있으며 각 사용자의 화면 크기 내에 배치 할 수 있습니다. (반응 형)
질문이 필요합니다. – DeadlyChambers
더 구체적이라고 생각합니다. – user3605228
어떻게 setDivPos()를 호출합니까? div1과 div2라는 두 개의 요소가 있습니까? – DeadlyChambers