体验Javasrcipt

 1 <!DOCTYPE html>
 2 <html>
 3     <head>
 4         <meta charset="UTF-8">
 5         <title></title>
 6     </head>
 7     <body>
 8         <!--
 9         <div onclick="alert('我是行内样式')">你好</div>
10         <script type="text/javascript" src="js/tool.js" ></script>  js优先执行
11         -->
12         <script type="text/javascript">
13             //内嵌式
14             alert("我是内嵌式");
15             prompt("请输入:");
16             confirm("你好吗?");
17             
18             //输出语句
19             console.log("我是控制台输出");
20             console.error("我是错误");//了解
21             console.warn("我是警告");//了解
22             
23             document.write("<h1>我是h1标签</h1>");//页面输出内容而且识别标签
24             
25         /**
26          *
27          * @param a
28          * @param b
29          * @returns {number}
30          */
31             function fn(a,b){
32                 return 111;
33             }
34         </script>
35     </body>
36 </html>
tool.js ===》
alert("我是外链式");

  

原文地址:https://www.cnblogs.com/BingBing-Deng/p/10237769.html