访问者屏幕:宽度

  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <p id="demo"></p>
  6.  
  7. <script>
  8. document.getElementById("demo").innerHTML =
  9. "屏幕宽度是:" + screen.width;
  10. </script>
  11.  
  12. </body>
  13. </html>