简体   繁体   English

JS / jQuery:带有选项的Popupbox

[英]JS/jQuery: Popupbox with options

Yes. 是。 I am using normal confirm boxes for my "did you mean firstname lastname?" 我在“我的意思是您的名字姓氏”上使用普通的确认框。 with yes/no 是/否

I also have "Who of these did you mean:" and i want a popup/dialog for this too, where you can select one of the names you ment. 我也有“您的意思是谁:”,我也想要一个弹出窗口/对话框,您可以在其中选择要提及的名称之一。

example so the popup would look like this: 示例,因此弹出窗口将如下所示:

Who did you mean?:
[ ] Bumb bam
[x] bim bum
[ ] bam bam
OK

Here's my code so far: 到目前为止,这是我的代码:

    $.ajax({
    url: "misc/sendPM.php",
    type: "POST",
    data: data,

    success: function(stuff){

      if(typeof stuff == "object") { 
        var err = confirm(stuff.error);
        if(err){ // if you press ok on "did you mean ....?"
        alert('You pressed OK');
        }

Or if you have another idea on how to do this, please dont hesitate. 或者,如果您对如何执行此操作有其他想法,请不要犹豫。

Real browser dialogs are not intended to be customizable. 实际的浏览器对话框不可自定义。 (I suppose you could go down the path of writing browser-specific extensions but that would be a huge waste of time...) (我想您可以沿用编写特定于浏览器的扩展的路径,但这将浪费大量时间...)

Consider showing a div that contains the user interface characteristics you need. 考虑显示一个div,其中包含所需的用户界面特征。 With jquery and css it's a straightforward 有了jQuery和CSS,这很简单

yourDivName.show(); or yourDivName.css('display',''); yourDivName.css('display','');

on click of a contained response button it's just as easy to hide() the div. 单击包含的响应按钮,就很容易对div进行hide()

I would use the jQuery BlockUI plugin instead of using the built-in alerts and popups. 我将使用jQuery BlockUI插件,而不是使用内置的警报和弹出窗口。 It's a nice full-featured plugin and I recommend it :) 这是一个不错的功能齐全的插件,我推荐它:)

I think you need something like jquery ui dialog . 我认为您需要像jQuery UI对话框之类的东西。 It is a lot easier and configurable. 它容易得多且可配置。

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

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