几个常用带页面操作及跳转效果的JS代码

注释:
window.history.go(-1); 是无刷新的,效果是能保持页面的状态;
location.href=/"test1.htm  或location.replace()  是带刷新的,会刷新数据,使数据刷掉,或再次加载.
location.reload();    为重新加载页面
document.getElementById("table1").rows[i].bgColor 获取某行单元格的背景色
confirm("是否将此留言信息删除?")

例子:
( 1 )
<a href="/"onClick="javascript :window.history.go(-1);return false;" class=fontsize14><</a>

( 2 )
<p align=center>3秒后自动返回你所指定的頁面
<script>window.setTimeout("location.href=/"test1.htm/"",3000);</script></p> 

( 3 )
<script>
if(window.name != "Test"){
  //如果页面的 name 属性不是指定的名称就刷新它
  location.reload();
  window.name = "Bencalie";
}
else{
  //如果页面的 name 属性是指定的名称就什么都不做,避免不断的刷新
  window.name = "";
}
</script>

( 4 )
<STYLE>.navPoint {
    COLOR:#ffffff; CURSOR: hand; FONT-FAMILY: Webdings; FONT-SIZE: 9pt
}
</STYLE>
<SCRIPT>
function switchSysBar(){
    if (switchPoint.innerText==7){
        switchPoint.innerText=8
        document.all("frmTitle").style.display="none"
    }
    else{
        switchPoint.innerText=7
        document.all("frmTitle").style.display=""
    }
}
</SCRIPT>
</HEAD>
<BODY scroll=no style="MARGIN: 0px">
<TABLE border=0 cellPadding=0 cellSpacing=0 height="100%" width="100%">
 <TBODY>
 <TR>
  <TD align=middle id=frmTitle noWrap vAlign=center name="frmTitle" style="Width:100px"></td>
  <TD bgColor=#333333 οnclick=switchSysBar() style="WIDTH: 10pt"><SPAN class=navPoint id=switchPoint title=关闭/打开菜单>7</SPAN>
  </TD>
  <TD style="WIDTH: 100%">
   </TD>
  </TR>
  </TBODY>
  </TABLE>
( 5 )
<IFRAME frameBorder=0 id=frmright name=forum
   src=""
   style="HEIGHT: 100%; VISIBILITY: inherit; WIDTH: 100%; Z-INDEX: 1"></IFRAME>
( 6 )
function yesno() {
if(confirm("是否将此留言信息删除?")){
return true;
}else return false;
}
</script>
<a href="del.asp" οnclick="return yesno()">删除留言</a>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值