Home  >  Article  >  Web Front-end  >  Script标签_html/css_WEB-ITnose

Script标签_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:47:50936browse

script

script 标签用于定义客户端脚本,比如 JavaScript.
script 元素即可包含脚本语句,又可通过 src 属性指向外部脚本文件.
必需的 type 属性规定脚本的 MIME 类型.
JavaScript 通常的用途是图像操作、表单验证以及内容动态更改.

属性 值 描述
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 标签

JavaScript中defer和async属性相关测试

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn