Untitled Paste

Created 26 days ago 18 views Javascript
Raw
<!DOCTYPE html>
<html>
<head>
  <title>Air Microbiology MCQ</title>
  <style>
    body {
      font-family: Arial;
      background: #f2f2f2;
      padding: 20px;
    }
    .question {
      background: white;
      padding: 15px;
      margin-bottom: 15px;
      border-radius: 8px;
    }
    .correct {
      background-color: #c8f7c5; /* green */
    }
    .wrong {
      background-color: #f7c5c5; /* red */
    }
    button {
      padding: 8px 15px;
      font-size: 15px;
      cursor: pointer;
    }
  </style>
</head>

<body>

<h2>🧪 Air Microbiology – Poll MCQ</h2>

<div class="question" id="q1">
  <p><b>1. Air microbiology deals with study of:</b></p>
  <input type="radio" name="q1" onclick="checkAnswer('q1','c')"> A. Soil microbes<br>
  <input type="radio" name="q1" onclick="checkAnswer('q1','c')"> B. Water microbes<br>
  <input type="radio" name="q1" onclick="checkAnswer('q1','c','correct')"> C. Air microbes<br>
  <input type="radio" name="q1" onclick="checkAnswer('q1','c')"> D. Food microbes
</div>

<div class="question" id="q2">
  <p><b>2. Most common airborne microbes are:</b></p>
  <input type="radio" name="q2" onclick="checkAnswer('q2','d')"> A. Protozoa<br>
  <input type="radio" name="q2" onclick="checkAnswer('q2','d')"> B. Algae<br>
  <input type="radio" name="q2" onclick="checkAnswer('q2','d','correct')"> C. Viruses only<br>
  <input type="radio" name="q2" onclick="checkAnswer('q2','d','correct')"> D. Bacteria & fungi
</div>

<script>
function checkAnswer(qid, correct, status) {
  let q = document.getElementById(qid);
  if (status === "correct") {
    q.className = "question correct";
  } else {
    q.className = "question wrong";
  }
}
</script>

</body>
</html>
JAVASCRIPT
1,774 characters
Quick Actions
Create New Paste Open Raw
<