반응형
자바스크립트로 텍스트를 출력할 수 있다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title></title> </head> <body> <script> document.writeln("hello"); //document 객체에 hello라고 보여준다 </script> </body> </html> | cs |
function을 이용해서 버튼 클릭시 뒤로가게하는 법
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title></title> </head> <body> <script> function duck(){ history.go(-1) //한단계 뒤로 } </script> <form> <input type="button" value="클릭!" onclick="duck()"> </form> </body> </html> | cs |
버튼 클릭시 창 띄워주게 하는법
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title></title> </head> <body> <script> function duck(turtle){ if(turtle.kebi[0].selected) alert("첫번째") if(turtle.kebi[1].selected) alert("두번째") if(turtle.kebi[2].selected) alert("세번째") if(turtle.kebi[3].selected) alert("네번째") } </script> <form> <input type="button" value="클릭!" onclick="duck(this.form)"> <select name="kebi"> <option selected>안녕..</option> <option>둘리</option> <option>석시</option> <option>넉삼</option> </select> </form> </body> </html> | cs |
반응형
'이전 게시글 > 컴퓨터#웹 HTML' 카테고리의 다른 글
<HTML> input 태그 속성 간단하게 모두 알아보기 (0) | 2017.02.27 |
---|---|
HTML <textarea> 태그 긴 글 텍스트박스 기능 (0) | 2016.02.17 |
HTML 많이쓰이는 태그 <dir> <menu> <hr> <img> 태그 (0) | 2016.02.13 |
문자를 나타내는 태그 HTML 물리적스타일/논리적스타일 (0) | 2016.02.13 |
HTML select option(select box)에서 값 가져오기 (1) | 2016.02.11 |