ASP.NET刷新页面的几种方法详解
程序员文章站
2024-02-29 12:48:10
第一种: 复制代码 代码如下:private void button1_click( object sender, system.eventargs e ) &n...
第一种:
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">
上一篇: Android手机信号强度检测详细介绍
下一篇: 浅谈Java注解和动态代理