如何使用 Javascript 在 asp.net 页面中显示是/否按钮
我必须在我的 asp.net 页面上的某些条件下显示是/否按钮,我使用 windows.confirm() 来显示该按钮,但是 windows.confirm 显示确定/取消按钮,有什么方法可以在中显示是/否按钮asp.net 页面而不是使用 Javascript 确定/取消?
I have to display yes/no button on some condition on my asp.net page , I used windows.confirm() to display that but windows.confirm displays Ok/Cancel Button , Is there any way I can display Yes/No Button in asp.net page instead of Ok/Cancel using Javascript ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
如果你想保持简单,只需检查一些 jQuery 或 YUI 插件,你就可以用几行代码启动并运行它。
例如,此使用 jQuery 和 这个使用 YUI。
If you want to keep it simple, just check some of the jQuery or YUI plugins, you can get that up and running with a couple of lines of code.
For example, this one uses jQuery and this one uses YUI.
http://bytes.com/groups/javascript/149838- yes-no-dialog-box-javascript
阅读此处:)
http://bytes.com/groups/javascript/149838-yes-no-dialog-box-javascript
Read there :)
您无法更改 JavaScript 警报上的按钮文本,并且虽然您无法更改 VBScript 消息框上的按钮文本,但它具有不同的文本。 我解决这个问题的方法是开发一个自定义 div,其中包含带有正确文本的按钮,这些按钮使用绝对定位和阴影效果显示,以提供消息框的外观。
You cannot change the button text on a JavaScript alert, and while you can't change them on a VBScript message box, it has different text. How I got around this was to develop a custom div that contains buttons with the correct text on them that is displayed using absolute positioning and a shadow effect to give the appearance of a message box.
如果不创建自定义模式对话框或使用已构建的模式,则无法跨浏览器。 如果你可以使用 ms ajax 那么它有一个你可以使用的模式。
not cross browser without creating an custom modal dialong or using one that is already built. if you can use ms ajax then it has a modal you can use.
您不能使用提示来完成此操作,您可以显示一个隐藏的 div,其中包含 html 控件和连接到按钮的 javascript。 当你想问问题时,显示之前隐藏的 div。
You can't do it using prompt, you can show a hidden div with html controls and javascript wired up to buttons. When you want to ask the question show the previously hidden div.
尝试这个。
JS代码:
`if(confirm('你确定吗???')){
{
}其他{
}`
Try this.
JS code:
`if(confirm('Are you sure???')){
{
}else{
}`