011_HTML脚本、路径

HTML脚本

脚本(script)是一种批处理文件的延伸,一种纯文本保存的程序,由系统的一个解释器,将其翻译成机器码,并按顺序执行。

 

<script>元素定义客户端脚本,如JavaScript

既可包含脚本语句,也可通过src属性

必需的 type 属性规定脚本的 MIME 类型

<html>

<body>

<script type=”text/javascript”>

document.write(“<h1>Hello world!</h1>”)

document.write(“hello world!”)

</script>

</body>

</html>

 

说明:

MIME(媒体类型,Multipurpse Internet Mail Extensions)

是一种标准,用于表示文档、文件、或字节流的性质和格式

格式:type/subtype

其对大小写不敏感,一般采用小写

text/html

image/jpeg

audio/*

vidwo/mp4

 

 

<noscript>标签

浏览器不支持脚本时,显示内容

<script type=”text/javascript”>

document.write(“hello world!”)

</script>

<noscript>Your browser does not support this script!

</noscript>