根据确认重定向到页面 [英] redirection to a page based on confirmation

查看:84
本文介绍了根据确认重定向到页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何显示味精,然后单击味精的确定"按钮重定向到页面. .


how to display a msg and then redirect to a page on click of okay button of the msg. .


Response.Write("<script>alert('my message')</script>");
Response.Redirect("page.aspx");


此代码重定向而未显示消息!


this code redirects without showing message!!

推荐答案

您好Pramod

试试以下

Response.Write(< script> if(confirm((``my message''))){window.location = urlname;}</script>");


希望对您有帮助
Hi Pramod

Try the following

Response.Write("<script>if(confirm((''my message''))){window.location=urlname;}</script>");


Hope this helps


尝试一下

Try this

ClientScriptManager CSM = Page.ClientScript;

            string strconfirm = "<script>if(window.confirm('Are you sure?')){window.location.href='Default2.aspx'}</script>";
            CSM.RegisterClientScriptBlock(this.GetType(), "Confirm", strconfirm, false);


此代码写入浏览器的输出指令,以显示警报消息用户.但是此输出将永远不会发送到客户端,因为下一行指示您的Web应用程序使用代码302和必须将用户重定向到的地址发送此客户端响应.
您应该使用Javascript从客户端执行重定向.该代码看起来像是以下内容:
This code writes to output instructions for browser to show alert message user. But this output will never be sent to the client, because next line instructs your web application to send this client response with code 302 and address to which the user must be redirected instead.
You should use Javascript to perform redirect from the client. The code would look loke the following:
Response.Write("<script>alert('my message'); ");
Response.Write("window.location='[new address]'</script>");


这篇关于根据确认重定向到页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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