35 lines
1.1 KiB
HTML
35 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<title>Lab 2</title>
|
|
</head>
|
|
|
|
<body>
|
|
<h1>Lab 2</h1>
|
|
<script>
|
|
/*
|
|
* Name: Levi McLean
|
|
* Project: Lab 1
|
|
* Submission date: September 18th, 2025
|
|
*/
|
|
|
|
var studentName; //unassigned variable
|
|
do {
|
|
studentName = prompt("Enter the student's name: "); //prompt for name, assign variable with value
|
|
if (studentName === null || studentName.trim() === "") {
|
|
alert("Please enter a student name");
|
|
}
|
|
} while (studentName === null || studentName.trim() === "");
|
|
alert("Thank you for your entry!"); //Pop up message alert
|
|
sessionStorage.setItem("Student Name", studentName);
|
|
|
|
const welcomeText = "Welcome to INFO-1272 Fall 2025 "; //set const welcomeText
|
|
const nameText = `You are ${sessionStorage.getItem("Student Name")}`;
|
|
document.write(welcomeText); //write const welcomeText
|
|
document.write("<br>");
|
|
document.write(nameText);
|
|
</script>
|
|
</body>
|
|
|
|
</html> |