主?函????明:
Dialog.open({ID,Title,URL,InnerHtml,InvokeElementId,Width,Height,Top,Left,Drag,OKEvent,ShowButtonRow,MessageTitle,Message,AutoClose,OnLoad})
ID:窗口id?,可省略。每?窗口的id必?是唯一的不能重复。
Title:窗口??。如不?此?默?值?""。
URL: 窗口?容?地址,或使用相?路?或??路?,注意如果使用http://www.5icool.org形式的??地址,?http://不能省略。
InnerHtml: 窗口?容html代?,用于直接?出html?容,注意不要?生成的?容因?不适?的?度或定位方式而破坏了Dialog的外?。
InvokeElementId: 本?面??藏的元素的id,用于?示?面??藏的元素中的html?容,注意不要??容因?不适?的?度或定位方式而破坏了Dialog的外?。
Width:窗口?度(dialog?容??度),值??值型,默?值?窗口可??的40%。
Height:窗口高度(dialog?容?高度),值??值型,默?值?窗口可??的20%。
Left:窗口距??器左?距离,值??值型或字符串型(?使用百分比??字符串型),如Left:"0%",Top:"0%"?左上,Left:"50%",Top:"50%"?居中,Left:"100%",Top:"100%"?右下。
Top:窗口距??器?端距离,值??值型或字符串型(百分比)。
Drag:是否允?拖?窗口,值?布?型(true|false),默?值?true,注意需要?面引用了Drag.js。
OKEvent:??确定按?后?行的函?。
CancelEvent:??取消按?或????按?后?行的函?,默????本Dialog。
ShowButtonRow:是否不?示按??,值?布?型(true|false),默?值?false,?定?了OKEvent或?用了addButton?自???true。
MessageTitle,Message:自定?的窗口?明?中的小??和?明。
ShowMessageRow:是否?示窗口?明?,值?布?型(true|false),默?值?false,?定?了MessageTitle或Message?自???true。
AutoClose:是否自行??,值??值型,默?值?false。
OnLoad:窗口?容?入完成后?行的程序,值?函?型。
窗体?的按?操作父??
var diag = new Dialog();
diag.Title = "窗体?的按?操作父Dialog";
diag.URL = "test.html";
diag.show();
var doc=diag.innerFrame.contentWindow.document;
doc.open();
doc.write('<html><body><input type="button" id="a" value="修改父Dialog尺寸" \
onclick="parentDialog.setSize(function(min,max){return Math.round(min+(Math.random()*(max-min)))}(300,800))" \
/><input type="button" id="b" value="??父窗口" onclick="parentDialog.close()" /></body></html>') ;
doc.close();
?定按?及取消按?的?性
var diag = new Dialog();
diag.Title="?置确定按?及取消按?的?性";
diag.ShowButtonRow=true;
diag.URL = "test.html";
diag.show();
diag.okButton.value=" OK ";
diag.cancelButton.value="Cancel";
自???
var diag = new Dialog();
diag.AutoClose=5;
diag.ShowCloseButton=false;
diag.URL = "javascript:void(document.write(\'?是?出窗口中的?容\'))";
diag.show();
??改?窗口大小
var diag = new Dialog();
diag.Title = "修改中窗体尺寸";
diag.URL = "javascript:void(document.write(\'?是?出窗口中的?容\'))";
diag.OKEvent = function(){
var doc=diag.innerFrame.contentWindow.document;
doc.open();
doc.write('<html><body>窗口尺寸改?600*300</body></html>') ;
doc.close();
diag.setSize(600,300);
};
diag.show();
diag.okButton.value="改?窗口大小"
不允?拖?
var diag = new Dialog();
diag.Drag=false;
diag.URL = "test.html";
diag.show();
??取消或????行相?方法
var diag = new Dialog();
diag.Title = "??取消或??按???行方法";
diag.CancelEvent=function(){alert("??取消或??按???行方法");diag.close();};
diag.URL = "test.html";
diag.show();
在?窗的?容?入完成后,?行方法
var diag = new Dialog();
diag.OnLoad=function(){alert("?面?入完成")};
diag.URL = "http://www.5icool.org/";
diag.show();
?示窗体?容?面??
var diag = new Dialog();
diag.URL = "http://www.5icool.org/";
diag.show();
?有?容?明?的新窗口
var diag = new Dialog();
diag.Title = "?有?明?的新窗口";
diag.Width = 900;
diag.Height = 400;
diag.URL = "http://www.5icool.org/";
diag.MessageTitle = "?元网站?容管理系?";
diag.Message = "?元网站?容管理系?是一?基于J2EE及AJAX技?的企??网站?容管理系?";
diag.show();
1. 普通窗口
在IE6下能??住select控件
Dialog.open({URL:"test.html"});
2. ?定了高?和??的普通窗口
var diag = new Dialog();
diag.Width = 600;
diag.Height = 300;
diag.Title = "?定了高?和??的普通窗口";
diag.URL = "test.html";
diag.show();
3. ?容??外部?接的窗口
var diag = new Dialog();
diag.Width = 900;
diag.Height = 400;
diag.Title = "?容??外部?接的窗口";
diag.URL = "http://www.5icool.org/";
diag.show();
?容??html代?的窗口
var diag = new Dialog();
diag.Width = 300;
diag.Height = 100;
diag.Title = "?容??html代?的窗口";
diag.InnerHtml='<div style="text-align:center;color:red;font-size:14px;">直接?出html,使用 <b>InnerHtml</b> ?性。</div>'
diag.OKEvent = function(){diag.close();};//??确定后?用的方法
diag.show();
5. ?容???藏的元素的html?容
var diag = new Dialog();
diag.Width = 300;
diag.Height = 150;
diag.Title = "?容???藏的元素的html";
diag.InvokeElementId="forlogin"
diag.OKEvent = function(){$id("username").value||Dialog.alert("用?名不能?空");$id("userpwd").value||Dialog.alert("密?不能?空")};//??确定后?用的方法
diag.show();
在?用?面按????出窗口
var diag = new Dialog();
diag.Modal = false;
diag.Title = "?出?有遮罩?的窗口";
diag.URL = "test.html";
diag.show();
??窗口按?代?: Dialog.close();
7. 在指定位置?出窗口
var diag = new Dialog();
diag.Width = 200;
diag.Height = 100;
diag.Modal = false;
diag.Title = "在指定位置?出窗口";
diag.Top="100%";
diag.Left="100%";
diag.URL = "test.html";
diag.show();
注:可使用?字或百分比(?百分比符?的字符串)?定?相?于?前窗口的位置,?算效果同css中用百分比定?背景?位置,如Left:"0%",Top:"0%"?左上,Left:"50%",Top:"50%"?居中,Left:"100%",Top:"100%"?右下。
返回值到?用?面
var diag = new Dialog();
diag.Title = "返回值到?用?面";
diag.URL = "test.html";
diag.OKEvent = function(){$id('getval').value = diag.innerFrame.contentWindow.document.getElementById('a').value;diag.close();};
diag.show();
var doc=diag.innerFrame.contentWindow.document;
doc.open();
doc.write('<html><body><input id="a" type="text"/>?在文本框里?入一些值</body></html>') ;
doc.close();
9. 代替window.alert及window.confirm
Dialog.alert("提示:你??了一?按?");
Dialog.confirm('警告:您确?要XXOO??',function(){Dialog.alert("yeah,周末到了,正是好?候")});
注:Dialog.alert(msg, func, w, h)第二??????“确定”按?后?行的函?。
Dialog.confirm(msg, funcOK, funcCal, w, h)第二??????“确定”按?后?行的函?,第三??????“取消”按?后?行的函?。
10. ?建其它按?
var diag = new Dialog();
diag.Title = "?建其它按?";
diag.URL = "test.html";
diag.show();
diag.addButton("next","下一步",function(){
var doc=diag.innerFrame.contentWindow.document;
doc.open();
doc.write('<html><body>?入了下一步</body></html>') ;
doc.close();
})
11. ?有?容?明?的新窗口
var diag = new Dialog();
diag.Title = "?有?明?的新窗口";
diag.Width = 900;
diag.Height = 400;
diag.URL = "http://www.5icool.org/";
diag.MessageTitle = "?元网站?容管理系?";
diag.Message = "?元网站?容管理系?是一?基于J2EE及AJAX技?的企??网站?容管理系?";
diag.show();