You are on page 1of 2

Java program for Student informa on applet :

// Define a JavaScript object to hold student informa on


var student = {
name: "Siddharth Jain",
rollNumber: "17309",
department: "Electronics and Computer Science",
grade: "B",
};

// Func on to display student informa on


func on displayStudentInfo() {
var studentInfoDiv = document.getElementById("studentInfo");
studentInfoDiv.innerHTML = `
<p><strong>Name:</strong> ${student.name}</p>
<p><strong>Roll Number:</strong> ${student.rollNumber}</p>
<p><strong>Department:</strong> ${student.department}</p>
<p><strong>Grade:</strong> ${student.grade}</p>
`;
}

// Call the func on to display student informa on


displayStudentInfo();
HTML program for the same :
<!DOCTYPE html>
<html>
<head>
< tle>Student Informa on</ tle>
</head>
<body>
<h1>Student Informa on</h1>
<div id="studentInfo">
<!-- Student informa on will be displayed here -->
</div>
<script src="student.js"></script>
</body>
</html>

OUTPUT :

You might also like