简体   繁体   English

javascript消息框

[英]javascript message box

I want to display an error message on my asp.net application.我想在我的 asp.net 应用程序上显示一条错误消息。 This message is a warning message, this is the way I did it:此消息是一条警告消息,我是这样做的:

CmdCalcInvoke.Attributes["onclick"] = "return confirm('Are you sure you want to calculate the certification? WARNING: If the quarter has not finished, all the partners status will change')";

The code above works fine.上面的代码工作正常。 The CmdCalcInvoke is an htmlInputButton . CmdCalcInvoke是一个htmlInputButton This is the message that the message box displays;这是消息框显示的消息;

Are you sure you want to calculate the certification?您确定要计算认证吗? WARNING: If the quarter has not finished, all the partners status will change警告:如果季度未结束,所有合作伙伴状态都会发生变化

What I want to do is to display this message, but wanted to highlight the WARNING word by making it bold, or displaying the word in red, can this be done???, can't remember seeing a message box with this characteristics, but I though i would ask in case我想要做的是显示此消息,但想通过将其加粗来突出显示警告词,或以红色显示该词,这可以做到吗???,不记得看到具有此特征的消息框,但我虽然我会问以防万一

Any suggestions will be welcome欢迎任何建议

you can if you dont use the default alert boxes.如果您不使用默认警报框,则可以。 Try using a javascript modal window which is just normal div markup that you can control the styling of.尝试使用 javascript 模态窗口,它只是您可以控制样式的普通 div 标记。 Look at blockui for jquery (there are loads of others)查看 jquery 的 blockui(还有很多其他的)

The modal dialog control I use is : http://foohack.com/tests/vertical-align/dialog.html http://foohack.com/2007/11/css-modal-dialog-that-works-right/我使用的模态对话框控件是: http : //foohack.com/tests/vertical-align/dialog.html http://foohack.com/2007/11/css-modal-dialog-that-works-right/

I find it works well across all browsers.我发现它适用于所有浏览器。 I've hacked it round to work well with ASP .NET, and that was pretty easy.我已经对它进行了改进,以便与 ASP .NET 配合使用,这非常简单。

It isn't possible to apply formatting to a standard dialogue box.无法将格式应用于标准对话框。 However if you really want to format it you could flash up the message in HTML either next to the button or as a absolutely placed div, which you could format with CSS.但是,如果您真的想格式化它,您可以在按钮旁边或绝对放置的 div 中以 HTML 格式显示消息,您可以使用 CSS 对其进行格式化。

否则,使用类似基于 LightBox 的解决方案,如Thickbox

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM