Home  >  Q&A  >  body text

javascript - I recently saw a website. The navigation bar was written using the js file document.writeln, and then the body was introduced into the index and the file was introduced at the beginning.

I recently saw a website. The navigation bar is written using the js file document.writeln, and then the body is introduced into the index and the file is introduced at the beginning. I would like to ask everyone, is there any difference between this method and writing tags directly in html?

滿天的星座滿天的星座2685 days ago573

reply all(3)I'll reply

  • ringa_lee

    ringa_lee2017-05-19 10:33:28

    No difference. This is to facilitate the dynamic generation of p structures.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-19 10:33:28

    No difference, right?

    reply
    0
  • 黄舟

    黄舟2017-05-19 10:33:28

    There is no difference, but I suspect that if it is written like this, if the file is too long, it may not be fully displayed?

    Because document.wirteln will treat the current file, and the current js code is also in this file,
    The code is gone, and the execution is still messed up. . . . .
    I encountered this situation when using document.wirie during testing before.

    reply
    0
  • Cancelreply