Home >Web Front-end >HTML Tutorial >Script tag_html/css_WEB-ITnose
script tag is used to define client-side scripts, such as JavaScript. The
script element can contain script statements and point to external script files through the src attribute.
The required type attribute specifies the MIME type of the script.
Common uses of JavaScript are image manipulation, form validation, and dynamic content changes.
async | async | 规定异步执行脚本(仅适用于外部脚本). |
type | text/ecmascript,text/javascript,application/ecmascript,application/javascript,text/vbscript | 指示脚本的 MIME 类型. |
charset | charset | 规定在脚本中使用的字符编码(仅适用于外部脚本). |
defer | defer | 规定当页面已完成解析后,执行脚本(仅适用于外部脚本). |
language | javascript,vbscript,livescript,other | HTML5不支持. |
src | URL | 定义指向包含脚本的文件的 URL(这样您就可以引用某个包含脚本的文件,而不是直接把脚本插入您的 HTML 文档中). |
xml:space | preserve | HTML 5 中不支持. |
HTML 5 tags
JavaScript Tests related to defer and async attributes