ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Webhacking.kr :: old-10๋ฒˆ
    ์นดํ…Œ๊ณ ๋ฆฌ ์—†์Œ 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 ๋กœ ๋ฐ”๋€๋‹ค.) 

     

    ๋!

    ๊ท€์—ฌ์šด ๋ฌธ์ œ์˜€๋‹ค.

    ๋Œ“๊ธ€

Designed by Tistory.