Why can't my javascript code in the head selection get an element?

前端 未结 3 597
醉梦人生
醉梦人生 2021-01-21 16:20

I have been working on a pi calculator in javascript for a long time now and I have finally finished. The problem is that my script in the head section:

document         


        
3条回答
  •  迷失自我
    2021-01-21 16:47

    You have two options:

    1. Wrap your code in a window.onload event.
    2. Place your at the bottom of the body right before .

提交回复
热议问题