求用javascript实现计数功能,并且不用刷新就能加1的?http://view.news.qq.com/zt/2008/512/index.shtml请你们看一下这个页面,就实现这种献花等功能

解决方案 »

  1.   


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title> New Document </title>
    <meta name="Generator" content="EditPlus">
    <meta name="Author" content="">
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    <style>
    #num{
    color:red;
    }
    h1{
    background-color:#cccccc;
    }
    </style>
    <script>
    function count(){
    var num = document.getElementById("num").innerHTML;
    num = parseInt(num) +1;
    //alert(num);
    document.getElementById("num").innerHTML = num ;}
    </script>
    </head><body>
    <div style="text-align:center">
    <h1>献花人数:<span id="num">1</span><h1>
    <p>
    <input type=button id="flower" value="献 花" onclick="count()">
    </div>
    </body>
    </html>
      

  2.   

    上面得到的num数,能不能一直保存啊???这样的话,一刷新就没有了,怎么办啊??谢谢!!!!!