Skip to content

Main #13

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Main #13

Changes from all commits
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
31 changes: 31 additions & 0 deletions CloneSuccess.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,37 @@

<body>
<center><h1>I am making some changes to this web page</h1></center>
<h3>Guess game</h3>
<p>I am thinking anumber between 1 to 100, Guess the number !</p>
<form>
<label for="gnumber">Guess the Number</label>
<input type="number" id="gnumber">
<input type="submit" name="" id="submit-guess" value="Check Now">
</form>
<h3 id="result"></h3>
<p>Number was <span id="random-number"></span></p>
<script>
const randomNumber = Math.floor(Math.random() * 100) + 1;
const span = document.getElementById('random-number')
const submitInput = document.getElementById('submit-guess')

const result = document.getElementById('result')

const checkNumber = (e)=>{
e.preventDefault()
const guessNumber = +document.getElementById('gnumber').value
if(guessNumber === randomNumber){
result.innerHTML = 'Great !, You win'
}else if(guessNumber > randomNumber){
result.innerHTML = 'Your guess is too high'

}else if(guessNumber < randomNumber){
result.innerHTML = 'Your guess is too low'
}
span.innerHTML = `${randomNumber}`
}
submitInput.addEventListener('click',checkNumber)
</script>
</body>

</html>