1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    3. <head>
    4. <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    5. <title>Document</title>
    6. <script src="common.js">
    7. </script>
    8. <style>
    9. div{
    10. width: 100px;
    11. height: 100px;
    12. border:1px solid red;
    13. }
    14. </style>
    15. </head>
    16. <body>
    17. <!--1.js代码嵌入在标签体里面-->
    18. <div onclick="alert('aa')"></div>
    19. </body>
    20. <script>
    21. alert("bb");
    22. //alert(k);//如果这个代码有错误,那么当前script标签中后面的代码就不会执行了
    23. mytest();
    24. </script>
    25. <script>
    26. alert("pp");
    27. </script>
    28. </html>

    test.gif