Tt
Example heading with h2 size
Example heading with h3 size
Following is sample java code.
int i = 10;
if(i>0){
System.out.println('positive');
}
<!DOCTYPE html>
<html>
<head>
<title>Student Registration</title>
<style>
.registration-form {
background-color: #f2f2f2;
padding: 20px;
margin-top: 50px;
border: 1px solid #d3d3d3;
border-radius: 5px;
width: 300px;
}
.input-field {
margin-bottom: 10px;
width: 100%;
}
.submit-btn {
width: 100%;
padding: 10px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
.submit-btn:hover {
background-color: #45a049;
}
.validation-message {
color: red;
background-color: #f8d7da;
border-color: #f5c6cb;
position: relative;
padding: .75rem 1.25rem;
margin-bottom: 1rem;
border: 1px solid transparent;
border-radius: .25rem;
}
</style>
</head>
<body>
<div class="registration-form" id="registrationForm">
<h3>Student Registration</h3>
<input type="text" id="studentId" class="input-field" placeholder="Student ID" />
<input type="text" id="studentName" class="input-field" placeholder="Student Name" />
<button type="submit" class="submit-btn" onclick="validateForm()">Submit</button>
<div id="validationMessage"></div>
</div>
<script>
function validateForm() {
var studentId = document.getElementById('studentId').value;
var studentName = document.getElementById('studentName').value;
var message = document.getElementById('validationMessage');
message.innerHTML = '';
if (studentId.length !== 6) {
message.innerHTML += '<div class="validation-message">Student ID must be 6 digits long.</div>';
}
if (/\d/.test(studentName)) {
message.innerHTML += '<div class="validation-message">Student name must not have any digits.</div>';
}
if (!studentName.trim().includes(' ')) {
message.innerHTML += '<div class="validation-message">Student name must have at least two names.</div>';
}
}
</script>
</body>
</html>