Document. write () is used to simply print the content to the page and print the content you need literally. Since you can output the variable, you will definitely want to control the display of the variable, for example, one of the most basic commands in position and style JS: document. write (), used to print the content to the page, you can print the content you need-document. write ("content"). Here, content is the content to be output. Of course, there is another situation where the content in JS needs to be output, such as variables, and so on. Therefore, document must be used. write (+ variable); of course, variable is the variable you want to output.
Since variables can be output, you certainly want to control the display of variables, such as positions and styles. The first control method is to add a style inside the application, such
Document. write ("= font-size: 20px; font-family = Helvetica;" content "", but if there are too many styles to be added, it will not only look bloated, it is not easy to modify.
In this case, it is certainly better to use the selector. However, because you need to use various double quotation marks (single quotation marks) when using the selector, you should avoid early matching between double quotation marks and single quotation marks, the method I want to avoid is to use \ "to remind the browser to avoid premature matching, for example:
Document. write ("
"+ Percentage +"
");
An ID selector named OK is defined here to control the style. Because the id name needs to be enclosed in double quotation marks, to avoid matching with the double quotation marks, use \ "to declare it, then in the CSS file
# OK {style ;}
You can define the style and position you want.