首页 > 技术文章 > JavaScript 脚本运行方式

liusuqi 2013-08-20 21:12 原文

  • 引用外部脚本文件
<script src="/path/to/example.js"></script>
  • 页面内联式
<script>
alert( "Hello World!" );
</script>
  • 属性嵌入式
<button onClick="alert( 'Good Bye World' );">Click Me Too!</button>
  • <noscript>
     为禁用js的用户提供了替代内容,它可以包含任何内容。

推荐阅读