Javascript弹出窗口

时间:2011-09-07 14:07:56

标签: javascript html

我从“www.hotscripts.com”,http://www.advancebydesign.com/itemdetails.php?item=15复制了此代码。 它的作用只是在屏幕中间显示一个简单的窗口。

需要3个非常简单的步骤:

1)创建一个按钮<input type="button" onclick='Javascript:my_box.Show();' value="Show Popup Box">

2)将此包含在头<script language="Javascript" type="text/Javascript" src="jscpopupbox.js"></script>

3)并且这也增添了头脑:

my_box = new jscPopupBox();
my_box.width = 400;
my_box.height = 450;

content_html = "<div style=\"padding:0;height:30px;margin:0;border:none;";
content_html+= "background-color:#CCF;clear:both;\"><input type=\"button\" ";
content_html+= "style=\"float:right;height:26px;width:26px;\" value=\"X\" ";
content_html+= "onclick='my_box.Hide();'></div>\n";

content_html+= "<iframe src=\"../license.txt\" width=\"100%\" style=\"";
content_html+= "border:none;padding:0;margin:0;\" height=\"420px\"></iframe>";

my_box.html = content_html;

我没有得到的是为什么我网站上的窗口出现在左上角,而不是中间。我没有触及源代码,当我在一个简单的HTML页面上尝试它时,它似乎工作。我的CSS干扰了吗?

1 个答案:

答案 0 :(得分:1)

您可能希望改为使用jQuery UI Dialog

相关问题