22.4.18

4158 ワード

<body>
  <input type="text" />
  <button>확인</button>
  <p>안녕하세요.</p>
  <script>
    const inputEl = document.querySelector('input');
    const buttonEl = document.querySelector('button');
    const pEl = document.querySelector('p');
    buttonEl.addEventListener('click', 할일);

    function 할일() {
      pEl.textContent = inputEl.value + '님 안녕하세요';
    }
  </script>
</body>
var http = require("http");
var fs = require("fs");
var mySet = function (request, response) {
  var url = request.url;
  if (request.url === "/") {
    url = "/index.html";
  }
  if (request.url === "/about") {
    url = "/about.html";
  }
  response.writeHead(200);
  var htmlFile = fs.readFileSync(__dirname + url);
  response.end(htmlFile);
};
var app = http.createServer(mySet);
app.listen(8080);