<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JavaScript语言基础---函数细节</title>
</head>
<body>
<input type="button" onclick="demo(); " value="执行函数" >
<input type="button" onclick="demo2(); " value="执行函数2" >
<input type="button" onclick="demo3(); " value="执行函数3" >
<script type="text/javascript">
function hello(){
alert("hello ! ");
}
function demo(){
alert( hello );
alert( hello() );
}
</script>
<script type="text/javascript">
function abc(a,b){
return a+b;
}
var add=abc;
function demo2(){
alert( add(1,2) );
alert( add(10,20) );
}
</script>
<script type="text/javascript">
function demo3(){
var btn1=document.getElementsByTagName("input")[0];
btn1.onclick=function(){
alert("okok....");
};
}
</script>
<script type="text/javascript">
for(var i=0;i<10;i++){
document.write("i= "+i+" ");
}
document.write("脚本1:i= "+i+" ");
</script>
<script type="text/javascript">
document.write("脚本2:i= "+i+" ");
</script>
<script type="text/javascript">
function show(){
var x=6;
x++;
};
document.write("x= "+x+"<br/>;");
</script>
<script type="text/javascript">
var y=2;
function change(y){
y=y+1;
alert(y);
}
change(y);
document.write("y= "+y);
</script>
</body>
</html>