JAVASCRIPT对话框命令不执行任何“可见”。 [英] JAVASCRIPT DIALOG BOX COMMAND IS NOT PERFORMING ANYTHING "visible".

查看:114
本文介绍了JAVASCRIPT对话框命令不执行任何“可见”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天所有,

我一直在尝试使用JavaScript显示一个对话框。

但是,突出显示的一段代码(如图所示)下面的代码)没有做任何我可以看到的可见。



Good day All,
I've been trying to get a dialog box to be displayed using JavaScript.
However, the highlighted piece of code (as shown in the code below) does not do anything 'VISIBLE' that I can see.

}
        else
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alertmessage", "javascript:alert('You cannot access this page yet. Please Log in or Register')", true);
            Response.BufferOutput = true;
            Response.Redirect("Account/Login.aspx", true);
        }
    }





我需要在对话框之前向用户显示一个对话框重定向到另一个网页。但是,用户被重定向到网页而没有弹出对话框。



请问如何解决这个问题,或者是否有一个简单的(初学者级别)资源或网站这可能会让我朝着正确的方向前进?



感谢您花时间阅读本文。期待您的回复。



I needed a dialog box to be presented to the user before the redirection to another webpage. However, the user is redirected to the webpage without the dialog box popping up.

Please how do I resolve this or is there a simple (beginner's level) resource or site that could push me in the right direction?

Thanks for taking the time to read this. Looking forward to your replies.

推荐答案

您没有看到弹出窗口的原因是您重定向到另一个页面。



因此,我可以想到几种解决方法。



1.重定向到另一页并在新页面检查的查询字符串中添加一个标志,然后显示消息框。

2.显示消息框,然后重定向到JavaScript中的其他页面,而不是C#。
The reason you don't see the popup is because you redirected to another page.

So, there are a couple of workarounds I can think of.

1. Redirect to the other page and add a flag in the query string that the new page checks for and then displays the messagebox.
2. Display the messagebox and then redirect to the other page in JavaScript, not in C#.


else
{
    Response.Write("alert('You cannot access this page yet. Please Log in or Register');");
    Response.BufferOutput = true;
    Response.Redirect("Account/Login.aspx", true);
}





尝试这个,如果有效的话:)



-KR



Try this, if it works :)

-KR


这篇关于JAVASCRIPT对话框命令不执行任何“可见”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆