窗口对象的属性和方法:
格式:
[window.]属性
[window.]方法(参数)
opener.属性
opener.方法(参数)
self.属性
self.方法(参数)
parent.属性
parent.方法(参数)
top.属性
top.方法(参数)
窗口名称.属性
窗口名称.方法(参数)
窗口对象的事件处理程序:
onBlur onDragDrop onError onFocus onLoad onMove onResize onUnload
- <Script>
- function checkPassword(testObject) {
- if (testObject.value.length < 6) {
- alert("密码长度不得小于6");
- testObject.focus();
- testObject.select();
- }
- }
- </Script>
- 请输入密码:
- <INPUT TYPE="text" onBlur="checkPassword(this)">
<Script>
function checkPassword(testObject) {
if (testObject.value.length < 6) {
alert("密码长度不得小于6");
testObject.focus();
testObject.select();
}
}
</Script>
请输入密码:
<INPUT TYPE="text" onBlur="checkPassword(this)">
- <Script>
- if (confirm("你满十八岁了吗?"))
- location = "adult.htm";
- else
- alert("等你成年以後再来吧!");
- </Script>
<Script>
if (confirm("你满十八岁了吗?"))
location = "adult.htm";
else
alert("等你成年以後再来吧!");
</Script>
这个可能被拦截
- <Script>
- var bgColor =
- prompt("你喜欢哪一种底色:/n浅蓝色请按1,粉红色请按2",1)
- if (bgColor == 1) document.bgColor = "#CCFFFF";
- else if (bgColor == 2) document.bgColor = "#FFCCFF";
- else document.bgColor = "#FFFFFF";
- </Script>