如何在asp.net应用程序中居中javascript警报消息框 [英] How to center the javascript alert message box in asp.net application

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

问题描述

我正在尝试在Google Chrome中显示以下警告消息框。

但是它位于页面顶部。我怎样才能使它成为WebForm的中心。谷歌浏览器出现问题。如果我在aspx的单独函数中写入并调用它..页面重定向而不显示消息。



我尝试过:



在特定按钮点击事件中我写了这个...



回复.Write(< script> alert('注册成功')< / script>);

Response.Write(< script> window.location.href ='changepwd.aspx ';< / script>);

I'm trying to display the following Alert message box in the google chrome.
But it's positioning at the top of the page. How can i make it Center to the WebForm. Issue occurred for google chrome. When if im writing that in a separate function in aspx and calling it.. Page is redirecting with out displaying the message.

What I have tried:

In a particular button click event i've written this...

Response.Write("<script>alert('registered successfully')</script>");
Response.Write("<script>window.location.href='changepwd.aspx';</script>");

推荐答案

通常,警告框的显示取决于您使用的浏览器。 javascript中的任何类型的消息框(警报或提示)都显示在谷歌浏览器的顶部,而它们显示在moz的中心。 Firefox和微软优势。如果你想在浏览器窗口的中心位置显示它,独立于浏览器,那么请学习java脚本的帮助。



在javascript中获取浏览窗口的内部宽度和内部高度。写一些简单的计算,找到中心位置。现在,使用弹出窗口,在浏览窗口的中心位置显示任何类型的消息。
Normally, display of alert box depends upon the browser you are using. The any kind of message box (alert or prompt) in javascript are displayed at top in google chrome, while they are displayed at center in moz. Firefox and Microsoft edge. If you want to display it anyhow at center location of browsing window independent of browser, then take help of java script.

Get innerwidth and innerheight of browsing window in javascript. Writing some simple calculation, find center location. Now, using popup window, display any kind of message at center location of browsing window.


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

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