Sunday 2 May 2021

create Quiz for your website

Quiz code for website

नीचे एक उदाहरण दिया गया है इस तरह क्विज बनाने के लिए मै आपको html कोड दे रहा हू  

1. Types Questions





ANSWER= (A) Types 2nd options
Explain:-

 

 Copy Quiz code for website 

<p>&nbsp;</p>
<p class="question"> 1. Types Questions </p>
<ul class="answers">

<input id="q1a" name="q1" type="radio" value="a" /> <label> A) Types 1st options </label> <br>
<input id="q1b" name="q1" type="radio" value="b" /> <label> B) Types 2nd options </label> <br>
<input id="q1c" name="q1" type="radio" value="c" /> <label> C) Types 3rd options </label> <br>
<input id="q1d" name="q1" type="radio" value="d" /> <label> D) Types 4th options </label> <br>

</ul>
  
<style>
#q1more {display: none;}
</style>

<span id="q1dots"></span>
<span id="q1more">
ANSWER= (A) Types 2nd options  <br>

Explain:- 
  </span>
  <br>

<button id="q1mybtn" onclick="q1function()">Check Answer </button>

<script>
function q1function() {
var q1dots = document.getElementById("q1dots");
var q1moreText = document.getElementById("q1more");
var q1btnText = document.getElementById("q1mybtn");

if (q1dots.style.display === "none") {
q1dots.style.display = "inline";
q1btnText.innerHTML = "Check Answer";
q1moreText.style.display = "none";
}
else {
q1dots.style.display = "none";
q1btnText.innerHTML = "Hide Answer";
q1moreText.style.display = "inline";
}
}
</script>