静态页更新点击率

静态页代码:
<body>
    <div id="ny_detailmain_tit02">
       点击率:<font color="red"><script src="/test/js.aspx?id=1"></script></font>
    </div>
</body>

aspx 页面代码:

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

<script runat="server">

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request["id"] != "")
            {
                xuwei.XCommand XC = new xuwei.XCommand();
                string num = XC.ExecuteScalar("select 人气 from 点击率 where 编号=" + Request["id"].ToString()).ToString();  //读阅读数
                XC.ExecuteNonQuery("update 点击率 set 人气=人气+1 where 编号=" + Request["id"].ToString());   //阅读数加1
                Response.Write("document.write('" + (Convert.ToInt32(num) + 1).ToString() + "');");
            }
            else
            {
                Response.Write("document.write('1');");
            }
        }
    }
</script>



==============================其它方式

1.用AJAX显示.
2 用iframe 里放一个aspx专门显示
3 用<script src="显示点数.aspx"></script>
4 生成SHTML静态文件.它可以包含include一个动态的aspx文件进行动态显示
原文地址:https://www.cnblogs.com/shuyu/p/1704706.html