重新开贴问问题,散分给大家
本人在做一个模拟摇奖程序,显示摇奖结果时有问题需要请教高手:开奖结果是7个号码,客户需求是要让这七个号码在特定时间开始每隔10秒依次按顺序呈现出来,(比方就是6点钟到了,就要显示开奖结果,首先第一个号码显示出来,过10秒后再显示第二号码,依次类推,直到七个号码完全显示出来)请大家帮忙看看,怎样实现这样的效果,谢谢!我把我的地面贴出来,请大家帮我看看:
前台:
<div class="box5">
<table width="500" border="0" cellspacing="1" cellpadding="1">
<tr>
<td colspan="2" height="50"> </td>
</tr>
<tr>
<td width="400" align="center"><font style="font-size:16px;"><b><%=year %>年第<%=code %>期开奖结果:</b></font></td>
<td align="left">
<%=res %></td>
</tr>
<tr>
<td height="30" colspan="2" align="left"></td>
</tr>
<tr>
<td height="30">開獎時間:每周一、三、五晚十九点四十五分</td>
<td height="30" align="left"> 當前時間為:<span id="time"></span></td>
</tr>
</table>
<script language="javascript" type="text/javascript">
function show()
{
now=new Date();
year=now.getYear();
month=now.getMonth()+1;
date=now.getDate();
hours=now.getHours();
minutes=now.getMinutes();
seconds=now.getSeconds();
if(minutes<=9)
minutes="0"+minutes
if(seconds<=9)
seconds="0"+seconds
time.innerHTML=year+"-"+month+"-"+date+" "+hours+":"+minutes+":"+seconds;
setTimeout("show()",1000);
}
show();
</script>
</div>
后台:
string oneimg = "<img src=\"/img/" + dt.Rows[0]["one"].ToString() + ".gif" + "\" width=\"30px\" height=\"30px\"/>";
string twoimg = "<img src=\"/img/" + dt.Rows[0]["two"].ToString() + ".gif" + "\" width=\"30px\" height=\"30px\"/>";
string threeimg = "<img src=\"/img/" + dt.Rows[0]["three"].ToString() + ".gif" + "\" width=\"30px\" height=\"30px\"/>";
string fourimg = "<img src=\"/img/" + dt.Rows[0]["four"].ToString() + ".gif" + "\" width=\"30px\" height=\"30px\"/>";
string fiveimg = "<img src=\"/img/" + dt.Rows[0]["five"].ToString() + ".gif" + "\" width=\"30px\" height=\"30px\"/>";
string siximg = "<img src=\"/img/" + dt.Rows[0]["six"].ToString() + ".gif" + "\" width=\"30px\" height=\"30px\"/>";
string sevenimg = "<img src=\"/img/" + dt.Rows[0]["tema"].ToString() + ".gif" + "\" width=\"30px\" height=\"30px\"/>";
//System.Threading.Thread.Sleep(1000);
res = oneimg + twoimg + threeimg + fourimg + fiveimg + siximg + sevenimg;
请高手赐教解决,谢谢
--------------------编程问答--------------------
<script language="javascript" type="text/javascript">
function show()
{
now=new Date();
year=now.getYear();
month=now.getMonth()+1;
date=now.getDate();
hours=now.getHours();
minutes=now.getMinutes();
seconds=now.getSeconds();
if(minutes<=9)
minutes="0"+minutes
if(seconds<=9)
seconds="0"+seconds
time.innerHTML=year+"-"+month+"-"+date+" "+hours+":"+minutes+":"+seconds;
setTimeout("show()",1000);
}
show();
</script>
明显的逻辑问题 --------------------编程问答-------------------- --------------------编程问答-------------------- --------------------编程问答-------------------- --------------------编程问答-------------------- 顶起 我是来接分的
1楼的方法应该可以吧 --------------------编程问答-------------------- 10秒是10000毫秒 --------------------编程问答-------------------- --------------------编程问答-------------------- --------------------编程问答-------------------- function test()
{
xmlhttp.open("get",url,true);
xmlhttp.onreadystatechange=function()
{}//通过ashx等获取数据,设置div.innerHtml="";
}
window.setimeOut("test()",1000);
定时调用 --------------------编程问答--------------------
我是把他有错的代码贴出来强调下....
那有什么方法撒... --------------------编程问答-------------------- 要怎么改啊? --------------------编程问答-------------------- 各位高手帮我写个代码咯,谢谢了,小弟急用!! --------------------编程问答-------------------- --------------------编程问答--------------------
setTimeout("show()",1000); 这个是1秒刷新一次吧.. --------------------编程问答-------------------- 1000是1秒。。。 --------------------编程问答-------------------- 现在是1秒和10秒都不重要,关键问题是要把这个功能实现 --------------------编程问答-------------------- 楼主抽奖得多少钱? --------------------编程问答--------------------
<body onload="doOnload();"></body>--------------------编程问答-------------------- 上面只是简单的修改你的逻辑,
<script language="javascript" type="text/javascript">
function doOnLoad(){
setInterval("show()",1000);
}
function show() {
now=new Date();
year=now.getYear();
month=now.getMonth()+1;
date=now.getDate();
hours=now.getHours();
minutes=now.getMinutes();
seconds=now.getSeconds();
if(minutes<=9)
minutes="0"+minutes
if(seconds<=9)
seconds="0"+seconds
time.innerHTML=year+"-"+month+"-"+date+" "+hours+":"+minutes+":"+seconds;
}
</script>
你那个业务估计要取得服务端时间,
动态取得中奖号码,
所以肯定要用到AJAX --------------------编程问答-------------------- 定时通过Ajax获取中奖号码即可!这个非常简单~~建议用Jquery实现
--------------------编程问答-------------------- 先生成第一个数,放到页面控件的innerText中,同时将该数保存在服务器端
生成第二个数,将其加入innerText中 obj.innerText += “23”;同时将该数保存在服务器端
依次类推
……
最后将服务器端的7个数排序后,重新写入obj.innerText --------------------编程问答-------------------- 我的后台是这样的:
if(DateTime.Now >= DateTime.Now.Date.AddHours(18).AddMinutes(10) & DateTime.Now <= DateTime.Now.Date.AddHours(18).AddMinutes(12))//在这个2分钟时间段里从后台去提取中奖号码
string ti = DateTime.Now.ToString();
string sql = "select * from GeCai where startime<#" + DateTime.Parse(ti) + "# order by startime desc";
DataTable dt = OleDbHelper.Query(sql).Tables[0];
if (dt != null)
{
string oneimg = "<img src=\"/img/" + dt.Rows[0]["one"].ToString() + ".gif" + "\" width=\"30px\" height=\"30px\"/>";
string twoimg = "<img src=\"/img/" + dt.Rows[0]["two"].ToString() + ".gif" + "\" width=\"30px\" height=\"30px\"/>";
string threeimg = "<img src=\"/img/" + dt.Rows[0]["three"].ToString() + ".gif" + "\" width=\"30px\" height=\"30px\"/>";
string fourimg = "<img src=\"/img/" + dt.Rows[0]["four"].ToString() + ".gif" + "\" width=\"30px\" height=\"30px\"/>";
string fiveimg = "<img src=\"/img/" + dt.Rows[0]["five"].ToString() + ".gif" + "\" width=\"30px\" height=\"30px\"/>";
string siximg = "<img src=\"/img/" + dt.Rows[0]["six"].ToString() + ".gif" + "\" width=\"30px\" height=\"30px\"/>";
string sevenimg = "<img src=\"/img/" + dt.Rows[0]["tema"].ToString() + ".gif" + "\" width=\"30px\" height=\"30px\"/>";
}
要怎样修改才可以达到我想要的效果 --------------------编程问答-------------------- Ajax这个不懂 --------------------编程问答-------------------- 哪个高手帮我解决一下,分可以再加 --------------------编程问答-------------------- --------------------编程问答-------------------- 明显打酱油的 --------------------编程问答--------------------
<script language="javascript" type="text/javascript">
function doOnLoad(){
setInterval("show()",1000);
}
var num=0;
function show() {
if(num<=7){
time.innerHTML=year+"-;
num++;
}else{
clearInterval();
}
}
</script>
随便补充一下... --------------------编程问答-------------------- 和进度条是不是一个思路。
<script type="text/javascript">setTimeout(function(){$("#loading div").animate({width:"68px"}).text("34%")},200)</script>
<script type="text/javascript">setTimeout(function(){$("#loading div").animate({width:"100px"}).text("已加载50%")},400)</script>
<script type="text/javascript">setTimeout(function(){$("#loading div").animate({width:"130px"}).text("已加载65%")},600)</script>
<script type="text/javascript">setTimeout(function(){$("#loading div").animate({width:"140px"}).text("已加载70%")},800)</script>
<script type="text/javascript">setTimeout(function(){$("#loading div").animate({width:"150px"}).text("已加载75%")},850)</script>
<script type="text/javascript">setTimeout(function(){$("#loading div").animate({width:"160px"}).text("已加载80%")},900)</script>
把前面的函数,改成显示图片
把后面的时间,设成10000
--------------------编程问答-------------------- 怎么没人帮我解决问题咯,我这个是要从后台提取数据的,和进度条有差别!
补充:.NET技术 , ASP.NET