μΉ΄ν…Œκ³ λ¦¬ μ—†μŒ

Webhacking.kr :: old-10번

\b\t 2021. 2. 16. 15:34

Goal 에 도달해야할 것 같은 YoU (μ™Όμͺ½μ— O) κ°€ 보인닀..

 

onclick ν•¨μˆ˜λ₯Ό 보면, this.style.left κ°€ 1600px 일 λ•Œ ?go=1600px 둜 μ΄λ™ν•œλ‹€.

 

onclick="
	this.style.left=parseInt(this.style.left,10)+1+'px';
	if(this.style.left=='1600px') this.href='?go='+this.style.left"

 

κ·Έλž˜μ„œ κ·Έλƒ₯ url 에 μž…λ ₯ν–ˆλ”λ‹ˆ, no hack κ°€ λœ¬λ‹€.

흠 이 방법은 μ•ˆλ˜λ‹ˆ parseInt() ν•¨μˆ˜λ₯Ό μ‚΄νŽ΄λ³΄λ©΄, 

parseInt( STRING, BASE ) : BASE λ₯Ό μ§„μˆ˜λ‘œ ν•˜μ—¬ STRING 을 int ν˜•μœΌλ‘œ λ³€ν™˜ν•˜μ—¬ λ°˜ν™˜.

ex. parseInt("10", 10) 은 10 λ₯Ό λ°˜ν™˜, parseInt("10", 16) 은 A λ₯Ό λ°˜ν™˜.

 

κ·ΈλŸ¬λ‹ˆ μ§€κΈˆ μƒν™©μ—μ„œ

this.style.left=parseInt(this.style.left,10)+1+'px';

λ₯Ό ν•˜λ‹ˆ, this.style.left 의 값이 1599 λ©΄ this.style.left λ₯Ό 1600px 둜 인식함을 μ•Œ 수 μžˆλ‹€.

 

μ΄λ²ˆμ—” html 을 직접 λ°”κΏ”μ€€λ‹€.

 

κ·€μ—½κ²Œλ„.. goal μœ„λ‘œ μ΄λ™ν•œ λͺ¨μŠ΅μ„ λ³Ό 수 μžˆλ‹€.

 

그러고 O λ₯Ό λˆ„λ₯΄λ©΄ (μœ„μ— μ»€μ„œκ°€ κ°€λ©΄ YoU 둜 바뀐닀.) 

 

끝!

κ·€μ—¬μš΄ λ¬Έμ œμ˜€λ‹€.