0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

これからはJavaScript勉強しよう 4回目

Last updated at Posted at 2024-04-25


<!DOCTYPE html>
<html lang="ja">

   <p>テストの点数を入力しましょう</p>
   <p>60点であれば合格です</p>
  <input type="text" id="score1">
  <input type="button" value="確認" id="btn">

  <p id="msg"></p>

<script>

function scorecheck(){

if (txtscore.value >= 101) {
  
msg.innerText = "入力に誤りがあります。"

} else if(txtscore.value >= 60) {

  msg.innerText = "合格です。"

} else {
  msg.innerText = "不合格です。"

}

}


txtscore = document.getElementById('score1');
btn1 = document.getElementById('btn');

btn1.addEventListener('click',scorecheck);

</script>
</html>



0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?