write.ejs 2.41 KB
<!DOCTYPE html>
<html>
<head>
    <link rel = 'stylesheet' href='stylesheets/style.css'/>
    <meta charset = "utf-8">
    <meta http-equiv="X-UA-Compatible" content = "IE=edge">
    <meta name = "viewport" content = "width=device-width, initial-scale=1">
    <title><%= title %></title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
    <link rel = 'bootstrap' href = 'javascripts/bootstrap.js'/>
    <link rel = 'jquery' href = 'javascripts/jquery-3.3.1.min.js'/>
</head>
<body>

<h1><%= title %></h1>
  <form method="POST" action="/write2">
    <table class = "table table-striped table-bordered table-hober">
        <thead>
        <tr>
            <td>작성자</td>
            <td><input type="text" name="creater_id" id="creater_id" required/></td>
        </tr>
        <tr>
            <td>제목</td>
            <td><input type="text" name="title" id="title" required/></td>
        </tr>
        <tr>
            <td>내용</td>
            <td><textarea name="content" id="content" cols="30" rows="10" required></textarea></td>
        </tr>
        <tr>
            <td colspan="2">
                <button type="submit">글쓰기</button>
            </td>
        </tr>
      </tbody>
    </table>
  </form>




<script>
    function onWriteSubmit()
    {
        if ( $("#creater_id").val().trim() == "" )
        {
            var message = "아이디를 입력해 주세요";
            $("#creater_id").val("");
            $("#creater_id").focus();
            alert(message);
            return false;
        }

        if ( $("#title").val().trim() == "" )
        {
            var message = "제목을 입력해 주세요";
            $("#title").val("");
            $("#title").focus();
            alert(message);
            return false;
        }

        if ( $("#content").val().trim() == "" )
        {
            var message = "본문 내용을 입력해 주세요";
            $("#content").val("");
            $("#content").focus();
            alert(message);
            return false;
        }


    }
</script>
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
	<!-- 모든 컴파일된 플러그인을 포함합니다 (아래), 원하지 않는다면 필요한 각각의 파일을 포함하세요 -->
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>

</body>
</html>