<!DOCTYPE html> <html> <head> <style> </style> </head> <body> <div class="hh">111</div> </body> <script> window.onresize=function(){ m=document.getElementsByClassName("hh") m.innerHTML=window.screen.width } </script> </html>
window.onresize=function(){ m=document.getElementsByClassName("hh") // 注意,这个m是个集合,类数组 m[0].innerHTML=window.screen.width } </script>
2.1m questions
2.1m answers
63 comments
56.6k users