JavaScript学习笔记--第五章.其它
来源:互联网 发布:linux更改用户所属组 编辑:程序博客网 时间:2024/06/07 07:36
第五章.其它
一. 状态栏
1.按钮调用
<script language="JavaScript">
<!-- Hide
function moveover(txt) {
window.status = txt;
setTimeout("erase()",1000);
}
function erase() {
window.status="";
}
// -->
</script>
参数:
Txt:状态栏欲显示的字符串
函数:
setTimeout: 是当某段设定的时间 "跑" 完了之後,便执行某函式
2.链接调用
<a href="tpage.html" onMouseOver="window.status='Just another stupid link...'; return true">
二.数组(Array)
function initArray() {
this.length = initArray.arguments.length
for (var i = 0; i < this.length; i++)
this[i+1] = initArray.arguments[i]
}
三.前进 后退
1.按钮调用
<INPUT TYPE="button" VALUE="Back" onClick="history.back()">
<INPUT TYPE="button" VALUE="Next" onCLick="history.forward()">
您也可以用 history.go(-1) 和 history.go(1) 代替
2.图片链接
<a href ="" onClick="parent.history.back(); return false;" onMouseOver="self.status='后退' ;return true;">
<img src="back.gif" border=0></a>
<a href ="" onClick="parent.history.forward(); return false;" onMouseOver="self.status='前进'; return true;">
<img src="forward.gif" border=0></a>
四.获得光标
1.函数调用
function setfocus() {
document.first.text1.focus();
return;
}
2.页面载入
<body onLoad="setfocus()">
五.滚屏
<SCRIPT Language="JavaScript">
<!--function scrollit(){
for (I=1; I<=500; I++){
parent.scroll(1,I)
}}
//-->
</SCRIPT>
六.热键
<script language="JavaScript1.2">
var travel=true
var hotkey=104 /*该值为热键的键值*/
var destination="index.htm" /*链接文件名*/
if (document.layers)
document.captureEvents(Event.KEYPRESS)
function backhome(e){
if (document.layers){
if (e.which==hotkey&&travel)
window.location=destination
}
else if (document.all){
if (event.keyCode==hotkey)
window.location=destination
}
}
document.onkeypress=backhome
</script>
七.页面自动刷新
每隔10秒自动刷新一次
<META content="10; URL=js67.htm" http-equiv=Refresh>
八.文件框的使能性(disabled)
<input type="checkbox" name="tp1" value="1" onclick="if(this.checked){txtNo.disabled=false}else{txtNo.disabled=true}">
<input type="text" name="txtNo" size="20" disabled>
九.复选框/单选框
属性就是:被选中 checked==true
第五章.其它
一. 状态栏
1.按钮调用
<script language="JavaScript">
<!-- Hide
function moveover(txt) {
window.status = txt;
setTimeout("erase()",1000);
}
function erase() {
window.status="";
}
// -->
</script>
参数:
Txt:状态栏欲显示的字符串
函数:
setTimeout: 是当某段设定的时间 "跑" 完了之後,便执行某函式
2.链接调用
<a href="tpage.html" onMouseOver="window.status='Just another stupid link...'; return true">
二.数组(Array)
function initArray() {
this.length = initArray.arguments.length
for (var i = 0; i < this.length; i++)
this[i+1] = initArray.arguments[i]
}
三.前进 后退
1.按钮调用
<INPUT TYPE="button" VALUE="Back" onClick="history.back()">
<INPUT TYPE="button" VALUE="Next" onCLick="history.forward()">
您也可以用 history.go(-1) 和 history.go(1) 代替
2.图片链接
<a href ="" onClick="parent.history.back(); return false;" onMouseOver="self.status='后退' ;return true;">
<img src="back.gif" border=0></a>
<a href ="" onClick="parent.history.forward(); return false;" onMouseOver="self.status='前进'; return true;">
<img src="forward.gif" border=0></a>
四.获得光标
1.函数调用
function setfocus() {
document.first.text1.focus();
return;
}
2.页面载入
<body onLoad="setfocus()">
五.滚屏
<SCRIPT Language="JavaScript">
<!--function scrollit(){
for (I=1; I<=500; I++){
parent.scroll(1,I)
}}
//-->
</SCRIPT>
六.热键
<script language="JavaScript1.2">
var travel=true
var hotkey=104 /*该值为热键的键值*/
var destination="index.htm" /*链接文件名*/
if (document.layers)
document.captureEvents(Event.KEYPRESS)
function backhome(e){
if (document.layers){
if (e.which==hotkey&&travel)
window.location=destination
}
else if (document.all){
if (event.keyCode==hotkey)
window.location=destination
}
}
document.onkeypress=backhome
</script>
七.页面自动刷新
每隔10秒自动刷新一次
<META content="10; URL=js67.htm" http-equiv=Refresh>
八.文件框的使能性(disabled)
<input type="checkbox" name="tp1" value="1" onclick="if(this.checked){txtNo.disabled=false}else{txtNo.disabled=true}">
<input type="text" name="txtNo" size="20" disabled>
九.复选框/单选框
属性就是:被选中 checked==true
- JavaScript学习笔记--第五章.其它
- JavaScript学习笔记 第五记
- 《JavaScript 语言精粹》 学习笔记 —— 第五章 继承
- 《JavaScript高级程序设计》学习笔记(第五章)- 上
- 【第五章-最佳实践】javascript DOM 编程艺术-学习笔记
- 《JavaScript高级程序设计》学习笔记(第五章)
- 学习笔记 第五章
- PHP学习笔记--第五章.数据库交互
- PySide学习笔记第五章-居中 窗口
- 学习笔记之其它
- Android学习笔记第五章
- 汇编学习笔记 第五章
- APUE第五章学习笔记
- 学习笔记--第五章神经网络
- python学习笔记 第五章
- javascript高级程序设计笔记(第五章)
- javascript高级程序设计笔记(第五章)
- javascript笔记--(第五章)运算符
- DEMO:系统登录对话框
- SetWindowLong
- 截断Sql Server事务日志
- JavaScript学习笔记--第三章. JavaScript 中的窗口操作
- JavaScript学习笔记--第四章.框架间对象的调用
- JavaScript学习笔记--第五章.其它
- API入门系列之一 -那‘烦人’的Windows数据类型。
- 点击iPhone屏幕,大头针落在触点的代码
- API入门系列之二 -Unicode还是ASCII
- Xml中SelectSingleNode方法中的xpath用法
- Java程序执行超时——Future接口介绍
- API入门系列之三 -那迷惑人的Windows字符和字符指针类型
- 600662股票
- ORA-12560解决方法