웹개발 공부/struts

login 화면 설명

붉은아네모네 2017. 4. 11. 01:23

/Exam0410/WebContent/WEB-INF/jsp/login.jsp



<%@ page language="java" contentType="text/html; charset=UTF-8"

pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>로그인</title>

<script

src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>

<script type="text/javascript">

$(document).ready(function() {

$("#btlogin").click(function() {

console.log($("#email").val());

});

}); /*이파일의 코드를 다 읽을때 까지 소스코드를 이행하지않겠다는 의미. */

</script>

</head>

<body>

<h3>로그인</h3>

<input type="text" id="email">

<button type="button" id="btlogin">로그인</button>

</body>

</html>

=========================================================================


가운데에

$(document).ready(function() {

$("#btlogin").click(function() {

console.log($("#email").val());

});

}); 

이부분은 해당파일의 소스코드를 다 읽을때 까지 위스크립트를 이행하지않겠다는 의미 이다.


좀 더 자세히 설명하자면


$(document).ready(function() {

도큐멘트를 기다린뒤 펑션을 실행하겠다.


$("#btlogin").click(function() {

id=""값이 btlogin인 녀석을 클릭하는 이벤트를 주었을 때


console.log($("#email").val());

콘솔로그를 사용해 id=""가 email인 녀석의 값을 찍어보겠다.

});

});