几个常用带页面操作及跳转效果的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 onclick=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" onclick="return yesno()">删除留言</a>

你可能感兴趣的:(JavaScript,asp,Go)