-1

js code

result

Question: why doesn't it display all the styles I made?

Barmar
  • 596,455
  • 48
  • 393
  • 495

1 Answers1

0

document.write erases everything on the page including your styles. You'll have to include your styles with document.write . So you'll probably have to something like

function disptayQuestion(questionIndex) {   
    var q = questions [questionlndex] ;     
    document.write('<link rel="stylesheet" type="text/css" href="yourstyle.css">');
    document.write( (questionlndex + 1) + "." + q.question + "<br>" );
    document.write(q.optionA +  "<br>");
    document.write(q.optionB +  "<br>");
    document.write(q.optionC +  "<br>");
    document.write(q.optionD);  

}
Raymond
  • 336
  • 4
  • 18