启用/禁用网页的自动刷新 [英] Enable/Disable auto refresh of the webpage

查看:103
本文介绍了启用/禁用网页的自动刷新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类似下面的代码,

I have a code like below,

<html>
<head>
<meta http-equiv="refresh" content="1" >
<title>Runtime Status Report</title>
</head>
<body>



因此,它总是刷新页面.因此不好.
我需要一个按钮来启用和禁用自动引用



Hence it is always refreshing the page. Hence it''s not good.
I need a button to enable and disable the auto referesh

推荐答案

您可以使用Timer控件来自动刷新页面.
在按钮上单击,则禁用计时器控件(如果已启用),反之亦然.
这样,您可以启用/禁用页面的自动刷新.
You may use Timer control to auto refresh your page.
On button click disable the timer control if its enabled and vice versa.
In this way, you can enable/disable auto refresh of the page.


Response.AddHeader
这是您想要的另一种方式.自动刷新它.

放置一个按钮以启用此自动刷新".将此代码放在:
Response.AddHeader
Here is a another way of what you want. Auto refreshing it, .

Place a button to enable this ''Auto refresh''. Put this code ther:
Response.AddHeader("Refresh", Convert.ToString("some time after which you need refresh");



放置另一个按钮以禁用此功能.删除此标题.



Place another button to disable this. Remove this Header.

Response.AppendHeader("Refresh", Convert.ToString("some very large time will work like no refresh");



您完成了!



You are done!


这篇关于启用/禁用网页的自动刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆