脚本:
<script language="javascript" type="text/javascript"> function showMsg() { var msg = $.ajax({ url: "../AJAX/GetMsg.aspx?ran=" + Math.random(), async: false }).responseText; if ($(".panel").css("display") != "block") { if (msg != null && msg != "" && !isHidden) { $.messager.show({ title: '提醒消息', msg: msg.split('■')[0] + '<center><input style="border:none" id="cb_isshow" type="checkbox" onclick="changeShow()" value="不再提醒">不再提醒</input></center>', showType: 'slide', 300, height: msg.split('■')[1], showSpeed: 600, timeout: 50000 }); } } setTimeout(showMsg, 60000); } </script>
后台:
using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Web.Services; public partial class AJAX_GetMsg : System.Web.UI.Page { zab_HuiFang zhf = new zab_HuiFang(); zab_SheJiYQ zsj = new zab_SheJiYQ(); protected void Page_Load(object sender, EventArgs e) { DateTime now = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); //提示框高度 int height = 100; //客户回访数量 提早一天提示 int hfcount = 0; DataTable hfdt = zhf.GetHFTongji(" and hf_khTime >= '" + now.AddDays(1) + "' and hf_khTime < '" + now.AddDays(2) + "'"); if (hfdt != null) { hfcount = hfdt.Rows.Count; } //设计图纸提交数量 提早一天提示 int sjcount = 0; DataTable sjdt = zsj.GetSheJi(" and ((sj_timePm >= '" + now.AddDays(1) + "' and sj_timePm < '" + now.AddDays(2) + "' and sj_jiaoTuOneState = 1)" + " or (sj_timeXg >= '" + now.AddDays(1) + "' and sj_timeXg < '" + now.AddDays(2) + "' and sj_jiaoTuTwoState = 1)" + " or (sj_timeSg >= '" + now.AddDays(1) + "' and sj_timeSg < '" + now.AddDays(2) + "' and sj_jiaoTuThreeState = 1)" + " or (sj_timeQT >= '" + now.AddDays(1) + "' and sj_timeQT < '" + now.AddDays(2) + "' and sj_jiaoTuFourState = 1))"); if (sjdt != null) { sjcount = sjdt.Rows.Count; } string msg = string.Empty; if (hfcount != 0) { msg += "<a target='iframe' href = '../TongJi/HuiFang_Tongji.aspx'>明天需要回访的客户有:" + hfcount + "个</a><br/><br/>"; height += 30; } if (sjcount != 0) { msg += "<a target='iframe' href = '../TongJi/JiaoTu_Tongji.aspx'>明天需要提交的图纸有:" + sjcount + "个</a><br/><br/>"; height += 30; } if (!string.IsNullOrEmpty(msg)) { msg += "时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "<br/><br/>" + "■" + height; } Response.Write(msg); } }