如何在特定时间显示警报消息作为警报或提醒

编程入门 行业动态 更新时间:2024-10-26 01:26:10
本文介绍了如何在特定时间显示警报消息作为警报或提醒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用的是Asp,VS2008。 如何显示提醒来自特定时间的消息。就像报警或提醒一样。 i使用了这几个代码但是点击时没有显示消息。 ------------------------------------------------

Hi, I am using Asp,VS2008. How to display alert message from specfic time . just like alarm or reminder. i have used this few code but message is not display on click . ------------------------------------------------

/ displays an alert box with a specified message public static void Alert(string message) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(@"script language=JavaScript>"); sb.Append(@"alert('" + message + "');"); sb.Append(@"</"); sb.Append(@"script>"); ((System.Web.UI.Page)HttpContext.Current.Handler).RegisterStartupScript(new Guid().ToString(), sb.ToString()); }

------------------------------ --------------------

--------------------------------------------------

public static class Alert { /// <summary> /// Shows a client-side JavaScript alert in the browser. /// </summary> /// <param name="message">The message to appear in the alert.</param> public static void Show(string message) { // Cleans the message to allow single quotation marks string cleanMessage = message.Replace("'", "\\'"); string script = "<script type=\"text/javascript\">alert('" + cleanMessage + "');</script>"; // Gets the executing web page Page page = HttpContext.Current.CurrentHandler as Page; // Checks if the handler is a Page and that the script isn't allready on the Page if (page != null && !page.ClientScript.IsClientScriptBlockRegistered("alert")) { page.ClientScript.RegisterClientScriptBlock(typeof(Alert), "alert", script); } } }

请帮帮我... ------------------------------------------------ ------------------- 问候 Mukesh

please help me... ------------------------------------------------------------------- Regards Mukesh

推荐答案

您可以使用计时器控制并指定显示模态窗口的毫秒间隔 You can use timer control and specify the interval in milli seconds for displaying modal window

您可以参考此链接以获取一些想法这个。 demos.telerik/aspnet-ajax/scheduler/examples/reminders/defaultcs.aspx?#qsf-demo-source [ ^ ] You can refer this link to get some ideas out of this. demos.telerik/aspnet-ajax/scheduler/examples/reminders/defaultcs.aspx?#qsf-demo-source[^]

使用计时器控件。在Timer控件的tick事件中调用javascript函数并显示警告。 设置Timer控件属性的时间。 -SG use a timer control. In tick event of the Timer Control call the javascript function and show the alert. Set the time in Timer control property. -SG

更多推荐

如何在特定时间显示警报消息作为警报或提醒

本文发布于:2023-11-27 05:25:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1636778.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:警报   消息   时间   如何在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!