티스토리 뷰

반응형
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<form name="form">
		<input type="text" name="userId" id="userId">
		<button type="submit" onclick="submint()">전송</button>
	</form>

	<script type="text/javascript">
		function submint() {
			//id값으로 제어하는 방법
			var input = document.getElementById("userId");
			alert("111111 " + input.value);
			
			//name값으로 제어하는 방법
			var input2 = document.form.userId;
			alert("222222 " + input2.value);
		}
	</script>
</body>
</html>



반응형
댓글
최근에 올라온 글
최근에 달린 댓글