본문 바로가기

노트필기

[Web] JSP class 0717-1

<!DOCTYPE html>

<html>

  <head>

    <meta charset="utf-8">

    <title></title>

  </head>

  <body>

    <script type="text/javascript">

      var random = parseInt(Math.random()*50)+1;

      var num = 0;

      var gameOverCnt = 5;

      var i = 0;

      for (i; i < gameOverCnt; i++) {

        var ask = prompt("1부터 50까지의 숫자입니다. 5번의 기회 중 " + (i+1) + "번째 기회입니다.", "");


        if (random == ask) {

          alert("Correct");

          break;

        } else alert(ask > random ? ask + "Low" : ask + "High");

      }

      alert(i == gameOverCnt ? "You lose" : "You Win");


    </script>

  </body>

</html>



---------------------------------------------------------------

<!DOCTYPE html>

<html>

  <head>

    <meta charset="utf-8">

    <title></title>

  </head>

  <body>

    <script type="text/javascript">

      var input = prompt("생성할 방의 수를 입력하세요.");


      document.write("<h1>" + input + "개의 방 생성</h1>");

      document.write("<table border = '1' cellspacing = '0'><tr>");

      for (var i = 0; i < input; i++) {

          document.write("<td><b>" + (i+1) + "번 방</b></td>")

        }

      document.write("</tr></table>");

    </script>

  </body>

</html>



---------------------------------------------------------------
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>
    <style media="screen">
      table {
        border: 2px solid black;
        border-collapse: collapse;
      }
      td {
        border: 2px solid black;
      }
    </style>
  </head>
  <body>
    <script type="text/javascript">
      var input = prompt("생성할 층의 수를 입력하세요.");

      document.write("<table>");
      for (var i = 0; i < input; i++) {
        document.write("<tr><td><b>" + (i+1) + "층 </b></td></tr>");
      }
      document.write("</table>");
    </script>
  </body>
</html>



---------------------------------------------------------------
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>
    <style media="screen">
      table {
        border: 2px solid black;
        border-collapse: collapse;
      }
      td {
        border: 2px solid black;
      }
    </style>
  </head>
  <body>
    <script type="text/javascript">
      var input_1 = prompt("생성할 층의 수를 입력하세요.");
      var input_2 = prompt("생성할 방의 수를 입력하세요.");

      document.write("<h1>" + input_1 + "층 " + input_2 +  "방 생성</h1> <table>");
      for (var i = 0; i < input_1; i++) {
        document.write("<tr>");
        for (var j = 0; j < input_2; j++) {
          document.write("<td>" + (i+1) + "층" + (j+1) + "방</td>");
            }
        document.write("</tr>");
      }
      document.write("</table>");
    </script>
  </body>
</html>



---------------------------------------------------------------
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>
    <style media="screen">
      img {
        width: 50px;
        height: 50px;
      }
    </style>
  </head>
  <body>
    <script type="text/javascript">
      document.write("<h1> 3*6*9 게임</h1>");

      var cnt = 0;
      for (var i = 0; i < 50; i++) {
          if ((i+1)%10 == 3 || (i+1)%10 == 6 || (i+1)%10 == 9) {
            cnt++;
          }
          if (parseInt((i+1)/10) == 3) {
            cnt++;
          }
          if (cnt==1) {
              document.write("<img src='../img/clap.jpg'>");
          } else if (cnt==2) {
              document.write("<img src='../img/manse.png'>");
          } else {
            document.write(i+1 + "  ");
          }
          cnt = 0;
        }
    </script>
  </body>
</html>



---------------------------------------------------------------


'노트필기' 카테고리의 다른 글

[Web] Servlet class07-19  (0) 2017.07.19
[Web] CSS class0718-1  (0) 2017.07.18
[Web] CSS class0717-2  (0) 2017.07.17
[Web] class0717-1  (0) 2017.07.17
[Web] class 0714-1  (0) 2017.07.14