刷新而不会使小工具空白 [英] Refreshing without blanking the gadget

查看:65
本文介绍了刷新而不会使小工具空白的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经鞭打了我的第一个小工具",显示GameServers.com标语状态信息.我从Quackit.com添加了一些JavaScript来执行JavaScript timedRefresh,但是每次刷新发生时,小工具都会在获取 更新.我想做的-如果可能的话,在渲染引擎的限制下-让它仅在拥有新图像后才替换图像,从而最大程度地减少刷新引起的视觉干扰.

I've whipped up "My first gadget" to display a GameServers.com banner status information. I've added some JavaScript from Quackit.com to perform a JavaScript timedRefresh, but each time the refresh happens the gadget removes the image while fetching the update. What I'd like to do -- if possible within the constraints of the rendering engine -- is have it only replace the image once it has the new one, thus minimising the visual distraction a refresh causes.

请注意,图像是整个小工具,因此这不是选择性刷新文本而不是图像的情况.

Note that the image is the entire gadget, so this is not a case of selectively refreshing text and not the images.

我怀疑这是不可能的,我需要重新创建"gadget"(小工具)在小工具后面,因此我可以选择性地刷新页面元素,但是欢迎您提出确认或建议.

I suspect this isn't possible and I'd need to recreate the "gadget" behind the gadget so I can just selectively refresh elements of a page, but confirmation or suggestions would be welcomed.

<!-- Auto-refresh code by Quackit.com -->
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=Unicode" />
	<title>[QT3] All large conquest maps</title>
  <style type="text/css">
  body
  {
   margin: 0;
   width: 160px;
   height: 365px;
   font-family: verdana;
   font-weight: bold;
   font-size: 20px;
  }
  </style>
	<script type="text/JavaScript">
	 function timedRefresh(timeoutPeriod) {
	  setTimeout("location.reload(true);",timeoutPeriod);
	 }
	</script>
 </head>
 <body onload="JavaScript:timedRefresh(60000)" style="background-image:url(background.jpg)">
<a href="http://www.gametracker.com/server_info/173.199.72.2:13010/" target="_blank"><img 
src="http://cache.www.gametracker.com/server_info/173.199.72.2:13010/b_160_400_1_ffffff_c5c5c5_ffffff_000000_1_1_0
.png" border="0" width="160" height="364" alt="" /></a>
 </body>
</html>

推荐答案

不要使用location.reload-它不是网页.

Don't use location.reload - it's not a web page.

尝试在函数timedRefresh中设置背景图片的src,并在函数本身上使用setTimeout..

Try setting the src of the background image inside function timedRefresh and using setTimeout on the function itself..


这篇关于刷新而不会使小工具空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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