JavaScript_2_实现
1. HTML中的脚本必须位于<script>与</script>标签之间
JavaScript是所有现代浏览器以及HTML5中的默认脚本语言
2. 脚本可被放置在HTML页面的<body>或<head>部分中,或者同时存在于两部分中。
通常的做法是把函数放入<body>部分中,或是放在页面底部。这样就可以把它们安置到同一处位置,不会干扰页面 的内容。
3. 可以把脚本保存到外部文件中,外部文件通常包含被多个网页使用的代码。
外部脚本不能包含<script>标签。
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" /> <script src="js/demo.js"></script> <!--外部脚本--> <!--<script>
function MyFunction()
{
document.getElementById("d1").innerHTML = "My First JavaScript Funtion";
}
</script>--> </head>
<body> <p id="d1">A Paragraph</p>
<button type="button" onclick="MyFunction()">Try it</button> <!--<script>
function MyFunction()
{
document.getElementById("d1").innerHTML = "My First JavaScript Funtion";
}
</script>--> </body>
</html>
JavaScript_2_实现的更多相关文章
随机推荐
- css如何改变placeholder的默认颜色值
input:-moz-placeholder {/* Mozilla Firefox 4 to 18*/ color: red; input::-moz-placeholder {/* Mozilla ...
- gcc -frandom-seed
-frandom-seed=string This option provides a seed that GCC uses when it would otherwise use random nu ...
- NFS原理详解
NFS原理详解 摘自:http://atong.blog.51cto.com/2393905/1343950 2013-12-23 12:17:31 标签:linux NFS nfs原理详解 nfs搭 ...
- Spring入门第八课
看如下代码 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http:// ...
- select2的远程加载非分页实例
$("#c01-select").select2({ ajax: { url: "data.json", dataType: 'json', delay: 25 ...
- 安装VMware-tools出现initctl: Job failed to start
安装VMware-tools中出现: ******* Creating a new initrd boot image for the kernel.update-initramfs: Generat ...
- 特性attribute,声明和使用attribute,应用attribute,AOP面向切面,多种方式实现AOP
1 特性attribute,和注释有什么区别2 声明和使用attribute3 应用attribute4 AOP面向切面5 多种方式实现AOP ---------------------------- ...
- python反编译之字节码
如果你曾经写过或者用过 Python,你可能已经习惯了看到 Python 源代码文件:它们的名称以.Py 结尾.你可能还见过另一种类型的文件是 .pyc 结尾的,它们就是 Python "字 ...
- P1295-创意吃鱼
题目描述 回到家中的猫猫把三桶鱼全部转移到了她那长方形大池子中,然后开始思考:到底要以何种方法吃鱼呢(猫猫就是这么可爱,吃鱼也要想好吃法 ^_*).她发现,把大池子视为01矩阵(0表示对应位置无鱼,1 ...
- SpringBoot(1)—启动原理之SpringApplication对象的创建
创建SpringApplication对象 SpringBoot版本为 2.1.1.RELEASE @SpringBootApplication public class SpringbootDemo ...