Question: Hi, I'm trying to make a page where the users can write their first and last name in the first page and then I want
Hi, I'm trying to make a page where the users can write their first and last name in the first page and then I want both first and last name to appear next to each other in the next page after clicking the button but I can't get it to work, I think the problem is in the syntax of line 49, here is my code:
<
<
Page 1
Page 2
Hello!
"use strict";
//
// Wait for DOM to load
document.addEventListener("DOMContentLoaded", function(){
document.getElementById("page2").style.display = "none"; // Hide div with name "page2"
document.getElementById("byt1").addEventListener("click", function(){
document.getElementById("page1").style.display = "none"; // Hide div with name "page1"
document.getElementById("page2").style.display = "block"; // Show div with name "page2"
// Move text from input field in page 1 to presenting area in page 2
document.getElementById("name").value = document.getElementById("fname").value + document.getElementById("lname").value;
document.getElementById("cbackground1").innerHTML = document.getElementById("cbackground").value;
});
document.getElementById("byt2").addEventListener("click", function(){
document.getElementById("page1").style.display = "block";
document.getElementById("page2").style.display = "none";
});
})
I want also to change the colour by selecting it on the first page and applying it on the other one but it's not working, for that I'm using the following css file
#name {
background: id="cbackground1";
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
