HTML

이다은·2024년 4월 5일
0

웹프로그래밍

목록 보기
2/7
post-thumbnail

Day-24

HTML

1-1.html

<html>
<head>
	<title>웹 페이지의 구성 요소</title>
</head>
<body>
	<h3>Elvis Presley</h3>
	<hr>
	He was an American singer and actor. In November
	1956, he made his film debut in <span>Love Me
	Tender</span>. He is often referred to as
	"<span>the King of Rock and Roll</span>".
</body>
</html>

1-2.html

<!DOCTYPE html>
 <html>
  <head>
  <meta charset="utf-8">
 <title>웹 페이지의 구성 요소</title>
   <style>
    body { background-color : linen; color : green;
    margin-left : 40px; margin-right : 40px;}
    h3 { text-align : center; color : darkred;}
    hr { height : 5px; border : solid grey;
    background-color : grey }
    span { color: blue; font-size: 20px; }
    </style>
  </head>
  <body>
  <h3>Elvis Presley</h3>
  <hr>
  He was an American singer and actor. In November
  1956, he made his film debut in <span>Love Me
  Tender</span>. He is often referred to as
  "<span>the King of Rock and Roll</span>".
</body>
</html>

1-3.html

<!DOCTYPE html>
<html>
<head><meta charset="utf-8">
<title>웹 페이지의 구성 요소</title>
<style>
body { background-color : linen; color : green;
margin-left : 40px; margin-right : 40px;}
h3 { text-align : center; color : darkred;}
hr { height : 5px; border : solid grey;
background-color : grey }
span { color: blue; font-size: 20px; }
</style>
<script>
function show() { // <img>에 이미지 달기
document.getElementById("fig").src = "ElvisPresley.png"
}
function hide() { // <img>에 이미지 제거
document.getElementById("fig").src= "";
}
</script>
</head>
<body>
<h3 onmouseover="show()" onmouseout="hide()">
Elvis Presley</h3>
<hr>
<div><img id="fig" src=""></div>
He was an American singer and actor. In November
1956, he made his film debut in <span>Love Me
Tender</span>. He is often referred to as
"<span>the King of Rock and Roll</span>".
</body>
</html>

source/2/score/math.html

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>
        수학과목
    </title>
</head>
<body>
<h1>수학 과목 페이지입니다.</h1>
</body>
</html>

source/2/score/science.html

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>
        과학과목
    </title>
</head>
<body>
<h1>과학 과목 페이지입니다.</h1>
</body>
</html>

2-12.html

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <base href="http://192.168.1.53/source/2/score/">
    <title>
        교과목 리스트
    </title>
</head>
<body>
<a href="math.html">수학</a><br>
<a href="science.html">과학</a><br>
</body>
</html>

모니터 : RGB

프린터 : CMYK

max = a > b ? a : b
min = a < b ? a : b

<shell script 내>
let i+=1

Q) while문을 이용해서 달력을 출력

원하는 달의 일수를 입력하세요.(28, 30, 31) :

else
다시 입력하세요..

quiz1.html


<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>While문을 이용하여 달력 출력</title>
</head>
<body>
    <h3>while문을 이용해서 달력 출력</h3>
    <hr />
    <script>
      while (1) {
        let n = prompt("원하는 달의 일수를 입력하세요.(28, 30, 31 중 택일)");
        n = parseInt(n); // 문자열을 숫자로 바꿈
        if (n == 30 || n == 31 || n == 28) {
          let i = 1;
          document.write("Sun Mon Tue Wed Thu Fri Sat<br>");
          while (i <= n) {
            if (i < 10)
              document.write("&nbsp;&nbsp;" + i + "&nbsp;&nbsp;&nbsp;");
            else document.write(i + "&nbsp;&nbsp;&nbsp;");
            if (i % 7 == 0) document.write("<br>");
            i++;
          }
          break;
        } else {
          alert("다시 입력하세요. (28, 30, 31 중 택일)");
          continue;
        }
      }
    </script>
</body>
</html>

random.html

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Random 숫자 추출</title>
</head>
<body>  
    <h3>Random 숫자 추출</h3>
    <hr />
    <script>
        let n = prompt("Random 숫자 최대값을 입력하세요.", 3);
        n = parseInt(n);
        let x = Math.floor(Math.random() * 3 + 1);
        document.write("Random Value : " + x);
    </script>
</body>
</html>

1 : 가위
2 : 바위
3 : 보

rsp.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>가위 바위 보 게임</title>
  </head>
  <body>
    <h3>가위 바위 보 게임</h3>
    <hr />
    <script>
        while(1) {
            let rsp_map = { 1: "가위", 2: "바위", 3: "보" };
            let user = prompt("1~3 사이의 숫자를 입력하세요.(1:가위, 2:바위, 3:보)");
            user = parseInt(user); // 문자열을 숫자로 바꿈
            if (user == 1 || user == 2 || user == 3) {
                let com = Math.floor(Math.random() * 3 + 1);
                verdict = user - com;
                document.write("User : " + rsp_map[user] + " vs  Com : " + rsp_map[com] + "<br>");
                if (verdict == -2 || verdict == 1)
                    document.write("당신이 이겼습니다.<br>");
                else if (verdict == 2 || verdict == -1)
                    document.write("당신이 졌습니다.<br>");
                else document.write("무승부입니다.<br>");     
                break;
            } else {
                alert("다시 입력하세요");
            }       
        }
    </script>
  </body>
</html>

rsp1.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Document</title>
  </head>
  <body>
    <h3>Rock Scissors Paper</h3>
    <hr />
    <script>
      while (1) {
        let rsp_map = { 1: "가위", 2: "바위", 3: "보" };
        let x = Math.floor(Math.random() * 2 + 1);
        let n = parseInt(prompt("가위(1) 바위(2) 보(3)!", 3));
        if (n == 1 || n == 2 || n == 3) {
          document.write("컴퓨터 : " + rsp_map[x]);
          document.write("<br /><br /> YOU : " + rsp_map[n]);
          document.write("<br /><br />");
          if (n == x) {
            document.write("무승부쓰~");
          } else if ((n + x) % 2 == 1) {
            n > x ? document.write("이겼쓰~ 뺌") : document.write("졌쓰~");
          } else if ((n + x) % 2 == 0) {
            n < x ? document.write("이겼쓰~ 뺌") : document.write("졌쓰~");
          }
          break;
        } else {
          alert("다시 입력하세요");
        }
      }
    </script>
  </body>
</html>
profile
초보 웹 개발자👩‍💻

0개의 댓글