ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 명품 웹 프로그래밍 6장 과제
    웹프로그래밍 2019. 5. 14. 18:44

    6-1.html

    <!DOCTYPE html>
    <html>
    <head>
    	<title>자바스크립트 코드 위치</title>
    	<script type="text/javascript">
    		function over(obj) {
    			obj.style.background='yellow';
    		}
    		function out(obj) {
    			obj.style.background='white';
    		}
    	</script>
    </head>
    <body>
    <h3>마우스를 올려보세요</h3>
    <hr>
    <div onmouseover="over(this)" onmouseout="out(this)">
    	여기에 마우스를 올리면 배경색이 노란색으로 변합니다.
    </div>
    </body>
    </html>

    6-1.js

    		function over(obj) {
    			obj.style.background='yellow';
    		}
    		function out(obj) {
    			obj.style.background='white';
    		}

    6-1-2.html

    <!DOCTYPE html>
    <html>
    <head>
    	<title>자바스크립트 코드 위치</title>
    	<script type="text/javascript" src="6-1.js"></script>
    </head>
    <body>
    <h3>마우스를 올려보세요</h3>
    <hr>
    <div onmouseover="over(this)" onmouseout="out(this)">
    	여기에 마우스를 올리면 배경색이 노란색으로 변합니다.
    </div>
    </body>
    </html>

    6-3.html

    <!DOCTYPE html>
    <html>
    <head>
    	<title>document.write()</title>
    </head>
    <body>
    <script type="text/javascript">
    	var i,j;
    	for(i=0 ; i<5 ; ++i) {
    		for(j=4-i ; j<5; ++j) {
    			document.write("*");
    		}
    		document.write("<br>");
    	}
    </script>
    </body>
    </html>

    6-3-2.html

    <!DOCTYPE html>
    <html>
    <head>
    <title>document.write()</title>
    </head>
    <body>
    <script>
    	document.write("<h3>document.write()로 표만들기</h3><hr>");
    	document.write("<table border='1'");
    	document.write("<tr>");
    	document.write("<th>");
    	document.write("n");
    	document.write("</th>");
    	for(j=0; j<10; j++) {
    		document.write("<td>");
    		document.write(j);
    		document.write("</td>");
    	}		
    	document.write("</tr><tr>");
    	document.write("<th>");
    	document.write("n<sup>2</sup>");
    	document.write("</th>");
    	for(j=0; j<10; j++) {
    		document.write("<td>");
    		document.write(j*j);
    		document.write("</td>");
    	}
    	document.write("</tr>");
    	document.write("</table>");
    </script>
    </body>
    </html>
    

    6-6.html

    <!DOCTYPE html>
    <html>
    <head>
    	<title>함수</title>
    </head>
    <body>
    <script type="text/javascript">
    	function big(a,b) {
    		return a>b ? a : b; 
    	}
    </script>
    <script type="text/javascript">
    	var b=big("625","555");
    	document.write("큰수="+b);
    </script>
    </body>
    </html>

    6-6-2.html

    <!DOCTYPE html>
    <html>
    <head>
    	<title>함수</title>
    </head>
    <body>
    <script type="text/javascript">
    	function pr(text,num) {
    		for(i=0 ; i<num ; ++i) {
    			document.write(text);
    		}
    	}
    </script>
    <script type="text/javascript">
    	pr("%",5)
    </script>
    </body>
    </html>

    openchallenge06.html

    6장과제.zip
    0.00MB

    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>openchallenge06</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" type="text/css" media="screen" href="main.css" />
        <script src="main.js"></script>
        <script>
            function printStar(n) {
                var i,j;
                var a=parseInt(n);
                if(isNaN(a)==true || a<=0) {
                    document.write("입력 오류 입니다.");
                }
                else {
                    for(i=0 ; i<n ; ++i) {
                        for(j=0 ; j<=i ; ++j) {
                            document.write("*");
                        }
                        document.write("<br>");
                    }
                }
            }
        </script>
    </head>
    <body>
    <script>
        document.write("<h3>별 문자 출력하기</h3><hr>");
        var n = prompt("정수를 입력하세요");
        printStar(n);
    </script>
    </body>
    </html>

    댓글

© 2018 TISTORY. All rights reserved.