1. 了解 onLoad.html 熟悉onLoad,onUnLoad方法
with.html 熟悉with方法的用法
onLoad.html页面代码 :
<html><head></head>
<body onLoad="alert('hello')" onUnload="alert('bye-bye')">
nihao
</body>
</html>
----------------------------
window_open.html
<html><head><title>新开窗口</title></head>
<body>
<script type="text/javascript">
var abc=window.open("with.html","newWin","toolbar=no,left=200,top=100,menubar=no,width=320,height=100,resizable=no");
</script>
<input type="button" οnclick="abc.close();" value=" 关闭弹出窗口" />
</body>
</html>
---------------------------------------
with.html 页面代码:
<html>
<head><title>函数</title></head>
<body>
<script type="text/javascript">
with(document)
{
write("This is a default document action");
write("<br>");
write("<font color=/"red/">");
write("this is a default document action too");
write("</font>");
}
</script>
</body>
</html>
-----------------------------------
for...in 的用法.html
<html><head><title>函数</title></head>
<body>
Javascript 中for...in循环的用法<br/>
在这里eee是一个下标值,实际上也是对象,
"alex"对象的属性名称为1,属性值为alex<br/><br/>
<script type="text/javascript">
var a = new Array("alex","mark","sean","victor","lynn");
for(eee in a)
{
document.write(eee+"---");
document.write(a[eee]+"<br>");
}
</script>
</body>
</html>
2. Javascript内置对象
this 指当前对象(也就是当前标签)
for...in
in 后跟一个对象,对此对象中的所有元素循环一次 ,用法请参见for...in的用法.html
with 为一段代码建立一个默认的对象,任何无对象的属性引用,都将使用该默认的对象
new 用于生成一个新的对象
3. Javascript事件处理
onFocus
onBlur
onChange 在select、text、textarea 的值被改变且失去焦点时
onClick
onLoad 当用户加载一个页面时
onUnLoad 当用户退出一个页面时
onMouseOver
onMouseOut
onSelect 当form对象中的内容被选中时
onSubmit 当用户按下提交按钮,提交表单之前执行这个方法