2011-09-07 175 views
0

我從「www.hotscripts.com」,http://www.advancebydesign.com/itemdetails.php?item=15複製了此代碼。 它只是在屏幕中間顯示一個簡單的窗口。需要Javascript彈出窗口

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

可能。你能鏈接到它不工作的例子嗎? – Maxx

回答