আপনার কোড সম্পাদক খুলুন।
Copy the code and paste it.Save as HTML file.You can save as Php if you want to attach Login ETc.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
div#test{border:#000 1px solid; padding:10px 40px 40px 40px;}
</style>
<script>
var pos = 0, test, test_status, question, choice, choices, chA, chB, chC, correct = 0;
var questions = [["What is 1 + 4?", "12", "5", "16", "B"],
["What is 2 - 1?", "7", "13", "1", "C"],
["What is 7 x 3?", "21", "24", "25", "A"],
["What is 8 / 4?", "10", "2", "4", "C"]];
function _(x){return document.getElementById(x);}
function renderQuestion(){test = _("test");
if(pos >= questions.length){test.innerHTML = "<h2>You got "+correct+" of "+questions.length+" questions correct</h2>";
_("test_status").innerHTML = "Test Completed";
pos = 0;
correct = 0;
return false;}
_("test_status").innerHTML = "Question "+(pos+1)+" of "+questions.length;
question = questions[pos][0];
chA = questions[pos][1];
chB = questions[pos][2];
chC = questions[pos][3];
test.innerHTML = "<h3>"+question+"</h3>";
test.innerHTML += "<input type='checkbox' name='choices' value='A'> "+chA+"<br>";
test.innerHTML += "<input type='checkbox' name='choices' value='B'> "+chB+"<br>";
test.innerHTML += "<input type='checkbox' name='choices' value='C'> "+chC+"<br><br>";
test.innerHTML += "<button onclick='checkAnswer()'>Submit Answer</button>";}
function checkAnswer(){choices = document.getElementsByName("choices");
for(var i=0; i<choices.length; i++){if(choices[i].checked){choice = choices[i].value;}}
if(choice == questions[pos][4]){correct++;}
pos++;
renderQuestion();}
window.addEventListener("load", renderQuestion, false);
</script>
</head>
<body>
<h2 id="test_status"></h2>
<div id="test"></div>
</body>
</html>
I am a Student Of Adam Query's YouTube Channel.
আমি প্রনব অধিকারী। বিশ্বের সর্ববৃহৎ বিজ্ঞান ও প্রযুক্তির সৌশল নেটওয়ার্ক - টেকটিউনস এ আমি 6 বছর 10 মাস যাবৎ যুক্ত আছি। টেকটিউনস আমি এ পর্যন্ত 23 টি টিউন ও 12 টি টিউমেন্ট করেছি। টেকটিউনসে আমার 3 ফলোয়ার আছে এবং আমি টেকটিউনসে 1 টিউনারকে ফলো করি।