-
자바 스크립트 함수언어/HTML&CSS&JAVA Script 2020. 4. 27. 17:39123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081<!DOCTYPE html><html><head><title></title><meta charset="utf-8"><script>function add(){var sum=1;return sum;}function add(x){var sum=x+1;return sum;}function add(x,y){var sum =x+y;return sum;}function add(x,y,z){var sum= x+y+z;return sum;}var r0=add();var r1=add(1);var r2=add(2,3);var r3=add(4,5,6);var r4=add(7,8,9,10);document.write("함수호출인자없음:"+r0+"<p/>");document.write("함수호출인자부족:"+r1+"<p/>");document.write("함수호출인자부족:"+r2+"<p/>");document.write("정상적인함수호출:"+r3+"<p/>");document.write("7,8,9만 인자값으로 적용:"+r4+"<p/>")</script></head><body></body></html>///////////////////////////////////<!DOCTYPE html><html><head><title></title><meta charset="utf-8"><script type="text/javascript">var text1="함수선언전 호출";var text2="함수선언전 호출";printMsg(text1);function printMsg(msg){document.write("함수호출 메시지:"+msg+"<br>");}printMsg(text2);</script></head><body></body></html>///////////////////////////////////<!DOCTYPE html><html><head><title></title><meta charset="utf-8"><script type="text/javascript">function printMsg(name,age) {document.write("학생이름:<b>"+name+"</b><br>");document.write("학생나이:<b>"+age+"</b><br>");}</script></head><body><button type="button" onclick="printMsg('홍길동',21)">학생정보</button></body></html>http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripterhttp://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172<!DOCTYPE html><html><head><title></title><meta charset="utf-8"><script type="text/javascript">var i=0;document.write(i);document.write("<br>");var name ="홍길동";document.write(name);document.write("<br>");var a=1;var b=2;var c=a+b;document.write(c);</script><script type="text/javascript">function msg(){window.alert("msg test");}//msg();function add(a ,b){c=a +b;alert(c);}function test(){document.getElementById("result").value="1234";}document.write("<br>");</script></head><body><button type="button" onclick="msg();"> click me </button><button type="button" onclick="add(1,2);"> click me2 </button><br><button type="button" onclick="test();"> click me3 </button><input type="text" name="result" id="result"></body></html>////////////////////////////////////////<!DOCTYPE html><html><head><meta charset="utf-8"><script type="text/javascript">function add(){var num1=document.getElementById('num1').value;var num2=document.getElementById('num2').value;//alert(typeof num1);var result=Number(num1)+Number(num2);document.getElementById('num3').value=result;}</script></head><body><input type="text" name="num1" id ="num1" size="3"> +<input type="text" name="num2" id ="num2" size="3"> =<input type="text" name="num3" id ="num3" size="3" ><br><input type="button" value="add" onclick="add();"></body></html>http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripterhttp://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs
'언어 > HTML&CSS&JAVA Script' 카테고리의 다른 글
jQuery 회원가입 (0) 2020.05.15 자바스크립트 로그인 화면 만들기 (0) 2020.04.27 position (0) 2020.04.27 CSS우선순위 (0) 2020.04.25 CSS가상클래스 선택자 (0) 2020.04.25