ASP.NET刷新页面的几种方法详解
2019/7/7 18:28:48
本文主要是介绍ASP.NET刷新页面的几种方法详解,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
第一种:
private void Button1_Click( object sender, System.EventArgs e )
{
Response.Redirect( Request.Url.ToString( ) );
}
第二种:
private void Button2_Click( object sender, System.EventArgs e )
{
Response.Write( "
<script language=javascript>window.location.href=document.URL;
</script>" );
}
第三种:
private void Button3_Click( object sender, System.EventArgs e )
{
Response.AddHeader( "Refresh","0" );
}
第四种:
private void Button6_Click( object sender, System.EventArgs e )
{
//好像有些不对?
//Response.Write( "
<script language=javascript>window.location.reload( );
</script>" );
}
第五种:(需替换<>)
<script><!--
var limit="3:00"
if ( document.images )
{
var parselimit=limit.split( ":" )parselimit=parselimit[0]*60+parselimit[1]*1
}
function beginrefresh( )
{
if ( !document.images )returnif ( parselimit==1 )window.location.reload( )else
{
parselimit-=1curmin=Math.floor( parselimit/60 )cursec=parselimit%60if ( curmin!=0 )curtime=curmin+"分"+cursec+"秒后重刷本页!"elsecurtime=cursec+"秒后重刷本页!"window.status=curtimesetTimeout( "beginrefresh( )",1000 )
}
}
window.onload=beginrefresh//--> </script><DIV style="Z-INDEX: 102;
LEFT: 408px;
POSITION: absolute;
TOP: 232px" ms_positioning="text2D">
<P><FONT size="3">自动刷新页面</FONT></P>
</DIV>
第六种:
<meta http-equiv="refresh" content="300;
url=target.html">
复制代码 代码如下:
private void Button1_Click( object sender, System.EventArgs e )
{
Response.Redirect( Request.Url.ToString( ) );
}
第二种:
复制代码 代码如下:
private void Button2_Click( object sender, System.EventArgs e )
{
Response.Write( "
<script language=javascript>window.location.href=document.URL;
</script>" );
}
第三种:
复制代码 代码如下:
private void Button3_Click( object sender, System.EventArgs e )
{
Response.AddHeader( "Refresh","0" );
}
第四种:
复制代码 代码如下:
private void Button6_Click( object sender, System.EventArgs e )
{
//好像有些不对?
//Response.Write( "
<script language=javascript>window.location.reload( );
</script>" );
}
第五种:(需替换<>)
复制代码 代码如下:
<script><!--
var limit="3:00"
if ( document.images )
{
var parselimit=limit.split( ":" )parselimit=parselimit[0]*60+parselimit[1]*1
}
function beginrefresh( )
{
if ( !document.images )returnif ( parselimit==1 )window.location.reload( )else
{
parselimit-=1curmin=Math.floor( parselimit/60 )cursec=parselimit%60if ( curmin!=0 )curtime=curmin+"分"+cursec+"秒后重刷本页!"elsecurtime=cursec+"秒后重刷本页!"window.status=curtimesetTimeout( "beginrefresh( )",1000 )
}
}
window.onload=beginrefresh//--> </script><DIV style="Z-INDEX: 102;
LEFT: 408px;
POSITION: absolute;
TOP: 232px" ms_positioning="text2D">
<P><FONT size="3">自动刷新页面</FONT></P>
</DIV>
第六种:
复制代码 代码如下:
<meta http-equiv="refresh" content="300;
url=target.html">
这篇关于ASP.NET刷新页面的几种方法详解的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!