首先感谢您抽出时间。我真的是编程新手所以我收到了的消息
login.do:34 Uncaught TypeError: Cannot set property 'action' of null
at login_ok (login.do:34)
at HTMLInputElement.onclick (login.do:245)
login_ok @ login.do:34
onclick @ login.do:245
问题在于;动作";不起作用,我不知道为什么。它是关于登录的。非常感谢。
<script type="text/javascript">
function login_ok(f) {
f.action = "login_ok.do";
f.submit();
if (document.getElementById("log_id").value != document
.getElementById("hidden1").value) {
alert("WRONG ID.");
}
if (document.getElementById("login_pw").value != document
.getElementById("hidden2").value) {
alert("WRONG PASSWORD.");
}
}
function join_go() {
location.href = "join.do";
}
function findidpw_go() {
location.href = "findidpw.do";
}
</script>
<input type="button" value="LOGIN" onclick="login_ok(this.form)">
有人让我上传更多的代码嗯,我不知道如何上传代码所以我把所有东西都放进去了感谢您理解
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>LOGIN VIEW</title>
<!-- LOGIN css -->
<style>
table {
border-collapse: collapse;
border-spacing: 0;
}
.wrapper { width:100%; height:80%; padding-top:5%; font-family: '돋움';}
.main { }
.login_box { width:300px; height:350px; padding: 40px; margin: 0 auto;
border: 1px solid black;}
.login_box .input_login { border-bottom: 2px solid gray; padding: 20px 0 9px 0;}
.login_box .input_login input { width: 100%; color: gray; font-size: 15px; border:none; font-family:inherit;}
.login_box .check { color: black; font-size: 14px; padding: 10px 0px 15px 0px; font-family: '돋움';}
.login_box .login input { width:100%; height:55px; font-size:16px;
padding:17px 0 16px; border:0; cursor:pointer; font-family:'돋움';}
.login_box .last { width:100%; margin-top:10px; border-top:1px solid gray; padding-top:20px;}
.login_box .last .join { float:left;}
.login_box .last .search { float:right;}
.login_box .last .join a { color: gray;}
.login_box .last .search a { color:gray;}
</style>
<!-- LOGIN SCRIPT -->
<script type="text/javascript">
function login_ok(f) {
f.action = "login_ok.do";
f.submit();
if (document.getElementById("log_id").value != document
.getElementById("hidden1").value) {
alert("WRONG ID.");
}
if (document.getElementById("login_pw").value != document
.getElementById("hidden2").value) {
alert("WRONG PW.");
}
}
function join_go() {
location.href = "join.do";
}
function findidpw_go() {
location.href = "findidpw.do";
}
</script>
</head>
<body>
<jsp:include page="../frame/header.jsp" />
<!-- 로그인창 -->
<div class="wrapper">
<div class="main">
<div class="login_box">
<div class="input_login">
<input type="text" name="m_id" placeholder="PUT ID">
</div>
<div class="input_login">
<input type="password" name="m_pw" placeholder="PUT PW">
</div>
<div class="check">
<label><input type="checkbox">LOGIN KEEP</label>
<input type="hidden" >
</div>
<div class="login">
<input type="button" value="LOGIN" onclick="login_ok(this.form)">
</div>
<div class="last">
<input class="join" type="button" value="JOIN" onclick="join_go(this.form)">
<input class="search" type="button" value="ID/PW FIND" onclick="findidpw_go(this.form)">
<!-- <div class="join"><a href="join_go(this.form)">JOIN</a></div>
<div class="search"><a href="findidpw_go(this.form)">ID/PW 찾기</a></div>
-->
</div>
</div>
</div>
</div>
<jsp:include page="../frame/footer.jsp" />
</body>
</html>
您的jsp中没有form
标记。