Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lesson-4-3 #16

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
51 changes: 51 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<title>My Portofolio</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<header>
<h1>I'm Jose Luis Izquierdo Hernandez</h1>
</header>
<section>
<h2>About me</h2>
<p>I am an student in Code The Dream</p>
</section>
<section>
<h2>Experience</h2>
<p>1 month in PSSI</p>
<p>4 month in Walmart</p>
</section>
<section id="skills">
<h2>Skills</h2>
<ul>

</ul>
</section>
<section>
<h2>Connect</h2>
<p><a href="mailto:[email protected]">Email Me</a></p>
<p><a href="https://www.linkedin.com/in/jose-luis-izquierdo-hernandez-938064245">My LinkedIn</a></p>
</section>
<section>
<h2>Leave a Message</h2>
<form name="leave_message">
<label>Your Name:<input type="text" name="usersName" required></label><br>
<label>Email Address:<input type="email" name="usersEmail" required></label><br>
<label>Your Message:<textarea name="usersMessage" required></textarea></label><br>
<button type="submit">Submit</button>
</form>
</section>
<section id="messages">
<h2>Messages</h2>
<ul>

</ul>
</section>
<footer></footer>
<script src="/js/index.js"></script>
</body>
</html>

46 changes: 46 additions & 0 deletions js/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const today = new Date();
const thisYear = today.getFullYear();
const footer = document.querySelector('footer');
const copyright = document.createElement('p');

const skillsSection = document.getElementById('skills');
const skills = ['HTML5', 'CSS', 'JavaScript', 'Teamwork', 'Problem Solving', 'Algorithms' ];
const skillsList = skillsSection.querySelector('ul');



copyright.innerHTML = `Jose Izquierdo ${thisYear}`;
footer.appendChild(copyright);

for(let i = 0; i < skills.length; i++){
let skill = document.createElement('li');
skill.textContent = skills[i];
skillsList.appendChild(skill);
}

// It didn't let me use the document.getElementsByName method in the line #22.
const messageForm = document.querySelector('form');
messageForm.addEventListener('submit', (e) => {
e.preventDefault();
const usersName = e.target.usersName.value;
const usersEmail = e.target.usersEmail.value;
const usersMessage = e.target.usersMessage.value;
console.log(usersName)
console.log(usersEmail)
console.log(usersMessage)
const messageSection = document.getElementById('messages');
const messageList = messageSection.querySelector('ul');
const newMessage = document.createElement('li');
newMessage.innerHTML = `<a href="mailto:${usersEmail}">${usersName} </a><span>wrote you ${usersMessage}</span>`;
const removeButton = document.createElement('button');
removeButton.textContent = 'remove';
removeButton.type = "button";
removeButton.addEventListener('click', (e) => {
const entry = removeButton.parentNode;
entry.remove();

})
newMessage.appendChild(removeButton);
messageList.appendChild(newMessage);
messageForm.reset();
})