JavaScript学习笔记--第五章.其它

第五章.其它
一. 状态栏
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.οnkeypress=backhome
</script>
七.页面自动刷新
每隔10秒自动刷新一次
<META content="10; URL=js67.htm" http-equiv=Refresh>
八.文件框的使能性(disabled)
<input type="checkbox" name="tp1" value="1" οnclick="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.οnkeypress=backhome
</script>
七.页面自动刷新
每隔10秒自动刷新一次
<META content="10; URL=js67.htm" http-equiv=Refresh>
八.文件框的使能性(disabled)
<input type="checkbox" name="tp1" value="1" οnclick="if(this.checked){txtNo.disabled=false}else{txtNo.disabled=true}">
<input type="text" name="txtNo" size="20" disabled>
九.复选框/单选框
 属性就是:被选中 checked==true

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值