本文介绍了如何在asp.net中获取警报消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我使用以下代码显示警报消息,但是我什么也没收到,请检查此

Hi

I used the following code to display alert message but i am not getting any thing Please check this

string strMsg = "Leave has been applied already between " + txtFromDate.Text.Trim() + " and " + txtToDate.Text.Trim() + "";
                        string script = "<script language=\"javascript\" type=\"text/javascript\">alert('" + strMsg + "');</script>";
                        Response.Write(script);

推荐答案

Page.RegisterStartupScript("Key", "<script type='text/javascript'>window.onload = function(){alert('Please accept Terms and Conditions before submitting.');return false;}</script>");


string script = "<script language="\""javascript\"

成为

string script = "<script language=\"javascript\"


string strMsg = "Leave has been applied already between " + txtFromDate.Text.Trim() + " and " + txtToDate.Text.Trim() + "";
                     string script = "<script language=\"javascript\" type=\"text/javascript\">alert('" + strMsg + "');</script>";
                     Response.Write(script);



注意:尝试显示不带回发的javascript警报消息



Note: Try to show alert message from javascript without postback


这篇关于如何在asp.net中获取警报消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 22:46