demo01.html 614 B

1234567891011121314151617181920212223242526272829303132
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Title</title>
  6. <style>
  7. div{
  8. width: 300px;
  9. height: 300px;
  10. margin: 10px auto;
  11. background-color: red;
  12. }
  13. </style>
  14. </head>
  15. <body>
  16. <div id="myDiv">
  17. </div>
  18. <script>
  19. let myDiv = window.document.getElementById("myDiv");
  20. myDiv.onmouseover=function (){
  21. console.log("鼠标移入了div框")
  22. }
  23. myDiv.onmouseout=function (){
  24. console.log("鼠标移出了div框........")
  25. }
  26. console.log(location.host);
  27. </script>
  28. </body>
  29. </html>