Question: why doesn't it display all the styles I made?
Asked
Active
Viewed 37 times
-1
![](../../users/profiles/1491895.webp)
Barmar
- 596,455
- 48
- 393
- 495
![](../../users/profiles/11221299.webp)
Abdullah Ajmal
- 159
- 12
-
What styles are you talking about? – Barmar Mar 19 '19 at 04:49
-
You can use inline style. However it is bad practice to use `document.write`. – Sagar Mar 19 '19 at 04:55
1 Answers
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);
}
![](../../users/profiles/10818862.webp)
Raymond
- 336
- 4
- 18