Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
githubAmanKumar authored Mar 2, 2024
1 parent 492ced2 commit 219b284
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
19 changes: 19 additions & 0 deletions 07_project2/chaiaurcode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const form = document.querySelector('form')

form.addEventListener("submit", function (e) {
e.preventDefault();

const height = parseInt(document.querySelector('#height').value)
const weight = parseInt(document.querySelector('#weight').value)

const results = document.querySelector('#results')

if (height === "" || height < 0 || isNaN(height)) {
results.innerHTML = `Please provide valid input! ${height}`
} else if (weight === "" || weight < 0 || isNaN(weight)) {
results.innerHTML = `Please provide valid input! ${weight}`
} else{
const bmi = (weight/((height*height)/10000)).toFixed(2)
results.innerHTML = `<span>${bmi}</span>`
}
})
47 changes: 47 additions & 0 deletions 07_project2/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.container {
width: 575px;
height: 500px;

background-color: #797978;
padding-left: 30px;
}
#height,
#weight {
width: 150px;
height: 25px;
margin-top: 30px;
}

#weight-guide {
margin-left: 75px;
margin-top: 25px;
}

#results {
font-size: 35px;
margin-left: 90px;
margin-top: 20px;
color: rgb(241, 241, 241);
}

button {
width: 150px;
height: 35px;
margin-left: 90px;
margin-top: 25px;
background-color: #fff;
padding: 1px 30px;
border-radius: 8px;
color: #212121;
text-decoration: none;
border: 2px solid #212121;

font-size: 25px;
}

h1 {
padding-left: 15px;
padding-top: 25px;

}

0 comments on commit 219b284

Please sign in to comment.