촉촉한초코칩
[Webhacking.kr] old-16 본문
<html>
<head>
<title>Challenge 16</title>
<body bgcolor=black onload=kk(1,1) onkeypress=mv(event.keyCode)>
<font color=silver id=c></font>
<font color=yellow size=100 style=position:relative id=star>*</font>
<script>
document.body.innerHTML+="<font color=yellow id=aa style=position:relative;left:0;top:0>*</font>";
function mv(cd){
kk(star.style.left-50,star.style.top-50);
if(cd==100) star.style.left=parseInt(star.style.left+0,10)+50+"px";
if(cd==97) star.style.left=parseInt(star.style.left+0,10)-50+"px";
if(cd==119) star.style.top=parseInt(star.style.top+0,10)-50+"px";
if(cd==115) star.style.top=parseInt(star.style.top+0,10)+50+"px";
if(cd==124) location.href=String.fromCharCode(cd)+".php"; // do it!
}
function kk(x,y){
rndc=Math.floor(Math.random()*9000000);
document.body.innerHTML+="<font color=#"+rndc+" id=aa style=position:relative;left:"+x+";top:"+y+" onmouseover=this.innerHTML=''>*</font>";
}
</script>
</body>
</html>
백그라운드에는 kk(1,1)이 계속 실행되고 클릭이나 키를 입력하면 mv가 실행되는 것 같다.
kk에서는 랜덤으로 숫자를 뽑아 rndc에 넣고, 그 값에 따라 폰트 색이 정해지고 위치가 정해진다.
mv에서는 키보드 키를 입력하면 별이 이동된다.
- W(119) : 위로 이동
- A(97) : 왼쪽으로 이동
- S(115) : 아래로 이동
- D(100) : 오른쪽으로 이동
마지막에 124와 같으면 php로 이동한다고 되어 있다. https://blog.outsider.ne.kr/322
124는 | (파이프)를 뜻한다. |를 누르니 문제가 해결되었다..ㅎ
'Study > Web Hacking' 카테고리의 다른 글
[Webhacking.kr] old-39 (0) | 2025.02.25 |
---|---|
[Webhacking.kr] old-26 (0) | 2025.02.25 |
Webhacking.kr old-38 (0) | 2024.11.08 |
Webhacking.kr - old-15 (1) | 2024.11.08 |
Webhaking.kr old-18 (1) | 2024.11.08 |