感谢张龙的视频
js12.html
<script type="text/javascript">
//鼠标移来移去触发不同的事件
//this 代表当前对象的引用即font对象
function mOver(object){
object.color = "red";
}
function mOut(object){
object.color = "yellow";
}
</script>
</head>
<body>
<font style="cursor:hand" οnclick="window.location.href='http://www.baidu.com'"
οnmοuseοver="mOver(this)" onmouseOut="mOut(this)" > 欢迎登陆 </font>
</body>
js14.html
<script type="text/javascript">
//设置定时时间
function ooo(){
setTimeout("alert('hello')", 1000);//用于指定在一段特定时间后执行某段程序
}
</script>
</head>
<body>
<input type="button" value ="点我一次定时" οnclick="ooo()">
</body>
js 15.html
<script type="text/javascript">
//每隔一秒出现一个数。随时可以终止计数。
var timeId = setInterval("count()", 1000);
var sec = 0;
function count(){
document.getElementById("num").innerHTML = sec++;
}
function stopClick(){
clearInterval(timeId);
}
</script>
</head>
<body>
<font color ="color" id="num">0</font>秒钟
<input type="button" value = "停止计时" οnclick="stopClick()" >
</body>
js 16.html
<script type="text/javascript">
//验证密码。如果密码长度太小,鼠标焦点重新回到输入框
function check(object){
if(object.value.length<=4){
alert("the length of password is too short");
object.focus();
object.select();//选中输入的文字
}
}
</script>
</head>
<body>
密码:<input type = "password" onblur ="check(this)">
</body>