单击按钮弹出表格 [英] Pop up form on button click

查看:101
本文介绍了单击按钮弹出表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以使用jquery在单击按钮时在弹出窗口中创建表单?表单将没有几个输入字段,并且保存"& 取消"按钮.因此,单击保存"后,表单中的信息将保存在数据库中,并返回到原始屏幕.我想要一个淡入式弹出窗口.

Is there a way to create a form in pop-up window on click of a button using jquery? Form will have few input fields and 'Save' & 'Cancel' buttons. So on clicking 'Save', the information in form will be saved in database and will be back to original screen. I would like to have a fade-in pop up window.

推荐答案

使用此代码

HTML

<div id="divdeps" style="display:none" title=""></div>

基于DOM的jQuery

Jquery on DOM ready

$("#divdeps").dialog({
    autoOpen: false,
    show: 'slide',
    resizable: false,
    position: 'center',
    stack: true,
    height: 'auto',
    width: 'auto',
    modal: true
});

此代码将初始化一个Dialog,并将其置于准备打开和依次关闭的状态. 如果要在页面加载时打开对话框,请在已准备好文档的代码之后添加以下代码行:

This code will initialize a Dialog and put it in state ready to be open and successively closed. If you want to open the dialog when the page loads then add this line of code just after the code you've already added in document ready:

$("#divdeps").dialog('open');

相反,如果要在单击事件之后打开对话框,请在应该触发打开操作的元素的click事件上添加相同的代码.

If instead you want to open the Dialog following a click event add the same code on the click event of the element that should fire the opening.

将表单添加到myDialog DIV中.如果您需要有关表单提交的更多帮助,请给我们更多详细信息...

Add your form inside the myDialog DIV. If you need more help regarding the form submission just give us more details...

这篇关于单击按钮弹出表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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