Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
inClass
  • Loading branch information
zubedauk committed Jul 30, 2020
commit 9eb8a614b9da50951574cb09d3d837a223fd35ee
47 changes: 29 additions & 18 deletions Week-3/InClass/DOM-practice/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,35 @@ console.log("Testing JS file loaded!")

// Task 1

// Without changing any of the HTML or CSS, update the <section> tags so that they have white backgrounds.






// Without changing any of the HTML or CSS, update the
//<section> tags so that they have white backgrounds.
let arrSection=document.querySelectorAll("section");
arrSection.forEach(function(each){
each.style.backgroundColor="white";
});
// Task 2

// Without changing any of the HTML or CSS, update the images on the page so that they are all centered.

// Hint: look at the CSS to see if there are any classes already written which you can use.






// Without changing any of the HTML or CSS,
// update the images on the page so that they are all centered.
// Hint: look at the CSS to see if there are any
//classes already written which you can use.
let arrImg=document.querySelectorAll("img");
arrImg.forEach(function(each){
each.style.display="block";
each.style.marginLeft="auto";
each.style.marginRight="auto";
});
// Task 3
// Google the date of birth and death of each of
//the people on the page. Without changing any of the
//HTML or CSS, add this in a paragraph to the end of their <section>.
let dateOfBirthAndDeath=["Born: 9 December 1906 and Died: 1 January 1992",
"Born: 26 August 1918 and Date of death: 24 February 2020",
"Born: 10 December 1815 and Died: 27 November 1852"];
let paragraph;
for(i=0;i<3;i++){
paragraph=document.createElement("p");
paragraph.style.backgroundColor="red";
paragraph.textContent=dateOfBirthAndDeath[i];
arrSection[i].appendChild(paragraph);
}

// Google the date of birth and death of each of the people on the page. Without changing any of the HTML or CSS, add this in a paragraph to the end of their <section>.