1. <script> ํƒœ๊ทธ

  • ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์ฝ”๋“œ๋ฅผ ๋„ฃ์„๋•Œ ์›น ๋ธŒ๋ผ์šฐ์ €์— HTML-Javascript ์ฝ”๋“œ๊ฐ€ ์‹œ์ž‘๋œ๋‹ค๊ณ  ์•Œ๋ฆด๋•Œ ์‚ฌ์šฉํ•˜๋Š” ํƒœ๊ทธ !!
<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="UTF-8">
    </head>
    <body>
        <script>
        document.write('Dozzing World');
        </script>
        <h1>Dozzing World</h1>
        <script>
        document.write(1+1);
        </script>
        <h5>1+1</h5>
    </body>
</html>
  • ๊ฒฐ๊ณผ

    ย 

2. Event

  • ์›นํŽ˜์ด์ง€์—์„œ ๋งˆ์šฐ์Šค๋ฅผ ํด๋ฆญํ–ˆ์„ ๋•Œ, ํ‚ค๋ฅผ ์ž…๋ ฅํ–ˆ์„ ๋•Œ, ํŠน์ •์š”์†Œ์— ํฌ์ปค์Šค๊ฐ€ ์ด๋™๋˜์—ˆ์„ ๋•Œ ์–ด๋–ค ์‚ฌ๊ฑด์„ ๋ฐœ์ƒ์‹œํ‚ค๋Š” ๊ฒƒ

1) onclick

  • onclick์˜ ์†์„ฑ ๊ฐ’์€ ์›น๋ธŒ๋ผ์šฐ์ €๊ฐ€ ๊ธฐ์–ตํ•˜๊ณ  ์žˆ๋‹ค๊ฐ€ ์‚ฌ์šฉ์ž๊ฐ€ ์ด๋ฒคํŠธ๋ฅผ ๋ฐœ์ƒ์‹œํ‚ค๋ฉด ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜๊ฒŒํ•˜๋Š” ์—ญํ• 
<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="UTF-8">
    </head>
    <body>
        <input type="button" value="click here" onclick="alert('Dozzing World')">
    </body>
</html>
  • ๊ฒฐ๊ณผ
  • <input type="button">์€ ๋ฒ„ํŠผ์„ ์ƒ์„ฑ, value๋Š” ๋ฒ„ํŠผ ํ…์ŠคํŠธ, onclick="alert('Dozzing World')"๋Š” Dozzing World๋ผ๋Š” ๊ฒฝ๊ณ ์ฐฝ ๋ฐœ์ƒ
    ย 

2) onchange

  • ์‚ฌ์šฉ์ž๊ฐ€ ํ…์ŠคํŠธ๋ฐ•์Šค์— ๊ธ€์ž๋ฅผ ์ž…๋ ฅํ•˜์—ฌ ๋‚ด์šฉ์ด ๋ณ€๊ฒฝ๋˜์—ˆ์„ ๋•Œ๋ฅผ ์ฒดํฌ
<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="UTF-8">
    </head>
    <body>
        <input type="text" onchange="alert('changed')">
    </body>
</html>
  • ๊ฒฐ๊ณผ

ย 

3. Event ์ข…๋ฅ˜

1) ๋งˆ์šฐ์Šค ์ด๋ฒคํŠธ

Event ์„ค๋ช…
click ์š”์†Œ์— ๋งˆ์šฐ์Šค๋ฅผ ํด๋ฆญํ–ˆ์„ ๋•Œ ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒ
dbclick ์š”์†Œ์— ๋งˆ์šฐ์Šค๋ฅผ ๋”๋ธ”ํด๋ฆญํ–ˆ์„ ๋•Œ ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒ
mouseover ์š”์†Œ์— ๋งˆ์šฐ์Šค๋ฅผ ์˜ค๋ฒ„ํ–ˆ์„ ๋•Œ ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒ
mouseout ์š”์†Œ์— ๋งˆ์šฐ์Šค๋ฅผ ์•„์›ƒํ–ˆ์„ ๋•Œ ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒ
mousedown ์š”์†Œ์— ๋งˆ์šฐ์Šค๋ฅผ ๋ˆŒ๋ €์„ ๋•Œ ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒ
mouseup ์š”์†Œ์— ๋งˆ์šฐ์Šค๋ฅผ ๋–ผ์—ˆ์„ ๋•Œ ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒ
mousemove ์š”์†Œ์— ๋งˆ์šฐ์Šค๋ฅผ ์›€์ง์˜€์„ ๋•Œ ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒ
contextmenu context menu(๋งˆ์šฐ์Šค ์˜ค๋ฅธ์ชฝ ๋ฒ„ํŠผ์„ ๋ˆŒ๋ €์„ ๋•Œ ๋‚˜์˜ค๋Š” ๋ฉ”๋‰ด)๊ฐ€ ๋‚˜์˜ค๊ธฐ ์ „์— ์ด๋ฒคํŠธ ๋ฐœ์ƒ

ย 

2) ํ‚ค ์ด๋ฒคํŠธ

Event ์„ค๋ช…
keydown ํ‚ค๋ฅผ ๋ˆŒ๋ €์„ ๋•Œ ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒ
keyup ํ‚ค๋ฅผ ๋–ผ์—ˆ์„ ๋•Œ ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒ
keypress ํ‚ค๋ฅผ ๋ˆ„๋ฅธ ์ƒํƒœ์—์„œ ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒ

ย 

3) ํผ ์ด๋ฒคํŠธ

Event ์„ค๋ช…
focus ์š”์†Œ์— ํฌ์ปค์Šค๊ฐ€ ์ด๋™๋˜์—ˆ์„ ๋•Œ ์ด๋ฒคํŠธ ๋ฐœ์ƒ
blur ์š”์†Œ์— ํฌ์ปค์Šค๊ฐ€ ๋ฒ—์–ด๋‚ฌ์„ ๋•Œ ์ด๋ฒคํŠธ ๋ฐœ์ƒ
change ์š”์†Œ์— ๊ฐ’์ด ๋ณ€๊ฒฝ ๋˜์—ˆ์„ ๋•Œ ์ด๋ฒคํŠธ ๋ฐœ์ƒ
submit submit ๋ฒ„ํŠผ์„ ๋ˆŒ๋ €์„ ๋•Œ ์ด๋ฒคํŠธ ๋ฐœ์ƒ
reset reset ๋ฒ„ํŠผ์„ ๋ˆŒ๋ €์„ ๋•Œ ์ด๋ฒคํŠธ ๋ฐœ์ƒ
select input์ด๋‚˜ textarea ์š”์†Œ ์•ˆ์˜ ํ…์ŠคํŠธ๋ฅผ ๋“œ๋ž˜๊ทธํ•˜์—ฌ ์„ ํƒํ–ˆ์„ ๋•Œ ์ด๋ฒคํŠธ ๋ฐœ์ƒ

ย 

4) ๋กœ๋“œ ๋ฐ ๊ธฐํƒ€ ์ด๋ฒคํŠธ

Event ์„ค๋ช…
load ํŽ˜์ด์ง€์˜ ๋กœ๋”ฉ์ด ์™„๋ฃŒ๋˜์—ˆ์„ ๋•Œ ์ด๋ฒคํŠธ ๋ฐœ์ƒ
abort ์ด๋ฏธ์ง€์˜ ๋กœ๋”ฉ์ด ์ค‘๋‹จ๋˜์—ˆ์„ ๋•Œ ์ด๋ฒคํŠธ ๋ฐœ์ƒ
unload ํŽ˜์ด์ง€๊ฐ€ ๋‹ค๋ฅธ ๊ณณ์œผ๋กœ ์ด๋™๋  ๋•Œ ์ด๋ฒคํŠธ ๋ฐœ์ƒ
resize ์š”์†Œ์— ์‚ฌ์ด์ฆˆ๊ฐ€ ๋ณ€๊ฒฝ๋˜์—ˆ์„ ๋•Œ ์ด๋ฒคํŠธ ๋ฐœ์ƒ
scroll ์Šคํฌ๋กค๋ฐ”๋ฅผ ์›€์ง์˜€์„ ๋•Œ ์ด๋ฒคํŠธ ๋ฐœ์ƒ

ย 

์ฐธ๊ณ 1
์ฐธ๊ณ 2

By Dozzing

๋‹ต๊ธ€ ๋‚จ๊ธฐ๊ธฐ

์ด๋ฉ”์ผ ์ฃผ์†Œ๋Š” ๊ณต๊ฐœ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ํ•„์ˆ˜ ํ•„๋“œ๋Š” *๋กœ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค