Question: why doesn't it display all the styles I made?
            Asked
            
        
        
            Active
            
        
            Viewed 39 times
        
    -1
            
            
         
    
    
        Barmar
        
- 741,623
- 53
- 500
- 612
 
    
    
        Abdullah Ajmal
        
- 367
- 3
- 14
- 
                    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);  
}
 
    
    
        Raymond
        
- 396
- 4
- 21

