Javascript pop-up window
I copied this code from "www.hotscripts.com", http://www.advancebydesign.com/itemdetails.php?item=15. What it does it just displays a simple window in the middle of the screen.
3 very simple steps are required:
1) create a button <input type="button" onclick='Javascript:my_box.Show();' value="Show Popup Box">
2)include this into head <script language="Javascript" type="text/Javascript" src="jscpopupbox.js"&开发者_如何转开发gt;</script>
3) and also this added to the head:
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;
What I dont get is why the windows on my website appear on the upper left corner, instead in the middle. I haven't touched the source code, and when I try it on a plain HTML page it seems to work. Is my CSS interfering?
You may want to look at using the jQuery UI Dialog instead.
精彩评论