您的位置:程序门 -> .net技术 -> c#



如何实现隔30秒执行一次自定义方法   web


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


如何实现隔30秒执行一次自定义方法 web[已结贴,结贴人:xbugirl]
发表于:2007-01-12 14:01:41 楼主
我自己定义了一个方法   showcat(i,temp);
  int   i       temp为字符串数组.

如何实现隔段时间就执行一次这个方法???


发表于:2007-01-12 14:05:471楼 得分:0
时钟
发表于:2007-01-12 14:13:082楼 得分:5
1.
setintenal()
2.
function   funname()
{
    settimeout(...);
    funname();
}
发表于:2007-01-12 14:14:013楼 得分:3
thread.sleep(3000)
发表于:2007-01-12 14:14:274楼 得分:30
在你的页面中   放一个 <iframe   frameborder= "0 "   height= "0 "   width= "0 "   marginheight= "0 "   marginwidth= "0 "   scrolling= "no "
src= "upaction.aspx "> </iframe>
然后在upaction.aspx中   定时30秒刷新
<html>
<head>
<meta   http-equiv= "refresh "   content= "30;url=upaction.aspx "   />
</head>
</html>
每刷新一次   在upation.aspx的pageload中   执行你的方法showcat(i,temp);
发表于:2007-01-12 14:33:225楼 得分:2
2楼   4楼方法君可
发表于:2007-01-12 14:43:366楼 得分:3
如果是web的话就   <meta   http-equiv= "refresh "   content= "30;url=upaction.aspx "   /> ,winform就timer
发表于:2007-01-12 14:52:527楼 得分:2
以上方法自己选吧
发表于:2007-01-12 15:01:428楼 得分:5
还是用线程吧
发表于:2007-01-12 15:05:299楼 得分:0
用   时钟
发表于:2007-01-12 15:36:2510楼 得分:0
用的timer.不过有个小问题.
response.write( " <script> var   temp   =   new   array(); ");
for(int   i   =   0;i   <   vname.length;i++)
{
          response.write( "temp[ "+i+ "]   =   ' "+vname[i].tostring()+ " '; ");
}
response.write( " </script> ");
为什么在timer1_elapsed()里执行这几句的时候,只执行第一句,后面都不执行了.
但是也不报错.
这段代码是把cs文件里的一个字符串数组传递到javascript里去.
发表于:2007-01-12 16:29:1811楼 得分:0
知道问题了,web用时钟不行.只能用线程


快速检索

最新资讯
热门点击