如何使用javascript打开模态弹出窗口。? [英] how to open modal popup using javascript .?

查看:87
本文介绍了如何使用javascript打开模态弹出窗口。?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用javascript打开模态弹出窗口。问题是我有三种不同类型的模态弹出窗口(3个div),这三个弹出窗口分别在3个按钮上打开。现在我想要单个dyanamic javascript和css,我称之为div。

i want to open modal popup using javascript. problem is that i have three diffrent type of modal popup (3 divs) and these three popup open on 3 button respectively. now i want single dyanamic javascript and css that i call these divs .

推荐答案

这很直接:

It's quite straight forward:
function openPopup(idDiv)
{


' #' + idDiv).dialog();
}
('#'+idDiv).dialog(); }



你分别在每个按钮上传递函数:


And you pass the function on each button respectively:

<input type="button"  önclick="openPopup('div1')" value="btn1" />
<input type="button" onclick="openPopup('div2')" value="btn2" />
<input type="button" onclick="openPopup('div3')" value="btn3" />







编辑:[Nirav Prabtani]



设置




[Nirav Prabtani]

Set


('#'+ idDiv).dialog ();



而不是


('#'+idDiv).dialog();

instead


这篇关于如何使用javascript打开模态弹出窗口。?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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