<%@ 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>Insert title here</title>
<style>
ul {
list-style:none;
}
li {
margin:10px;
}
li label {
width:120px;
float:left;
text-align:right;
padding-right:8px;
}
input[type="submit"] {
text-align:center;
width:100%;
height:30px;
margin-top:15px;
}
</style>
<link href="StyleSheet1.css" type="text/css" rel="stylesheet" />
</head>
<body>
<%@include file="myNav.html" %>
<%@include file="myNav1.html" %>
<form name="signupform" action="singUp_ok.jsp" method="post">
<fieldset>
<legend>Login Information</legend>
<ul>
<li>
<label for="user-id">ID </label>
<input type="text" name="user-id">
</li>
<li>
<label for="pwd1"> Password </label>
<input type="password" name="pwd1">
</li>
<li>
<label for="pwd2"> Confirm Password </label>
<input type="password" name="pwd2">
</li>
</ul>
<input type="button" value="join" onclick="signUpCheck()">
</fieldset>
</form>
</body>
</html>
<script language="javascript">
function singUpCheck() {
var form = document.signupform;
if(!form.user-id.value) {
alert("Please enter your ID");
form.user-id.focus();
return;
}
form.submit();
}
</script>
Above is my jsp code.
I want to validate it with JavaScript, but there is no response even if I press the subscribe button.
Please check if the code for validation is correct.
Where do developers usually put their style sheets when working? Do you put it in the jsp?
jsp javascript
<script>
function signUpCheck() {
var form = document.signupform;
if(!form['user-id'].value) {
alert("Please enter your ID");
form['user-id'].focus();
return;
}
alert('success');
}
</script>
Change it like the sauce above.
562 Who developed the "avformat-59.dll" that comes with FFmpeg?
571 PHP ssh2_scp_send fails to send files as intended
563 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
566 Understanding How to Configure Google API Key
583 Uncaught (inpromise) Error on Electron: An object could not be cloned
© 2024 OneMinuteCode. All rights reserved.