Dialog.open({ID,Title,URL,InnerHtml,InvokeElementId,Width,Height,Top,Left,Drag,OKEvent,ShowButtonRow,MessageTitle,Message,AutoClose,OnLoad})
Dialog.open({ URL:"test.html"});
var diag = new Dialog(); diag.Width = 600; diag.Height = 300; diag.Title = "设定了高宽和标题的普通窗口"; diag.URL = "test.html"; diag.show();
var diag = new Dialog(); diag.Width = 900; diag.Height = 400; diag.Title = "内容页为外部连接的窗口"; diag.URL = "http://www.5icool.org/"; diag.show();
var diag = new Dialog(); diag.Width = 300; diag.Height = 100; diag.Title = "内容页为html代码的窗口"; diag.InnerHtml='直接输出html,使用 InnerHtml 属性。' diag.OKEvent = function(){diag.close();};//点击确定后调用的方法 diag.show();
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();
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('请在文本框里输入一些值') ; doc.close();
Dialog.alert("提示:你点击了一个按钮"); Dialog.confirm('警告:您确认要XXOO吗?',function(){Dialog.alert("yeah,周末到了,正是好时候")});注:Dialog.alert(msg, func, w, h)第二个参数为点击“确定”按钮后执行的函数。
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('进入了下一步') ; doc.close(); })
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();
var diag = new Dialog(); diag.URL = "http://www.5icool.org/"; diag.show();注:如果窗体内为iframe内容页,并且没有设置Title属性,并且引用页和当前页在同一个域内,则显示显示窗体内容页面标题。
var diag = new Dialog(); diag.OnLoad=function(){alert("页面载入完成")}; diag.URL = "http://www.5icool.org/"; diag.show();注:如果窗体内为iframe内容页,要在载入完成后对内容页作操作,必须考虑访问权限,如引用页和当前页应在同一个域内。
var diag = new Dialog(); diag.Title = "点击取消或关闭按钮时执行方法"; diag.CancelEvent=function(){alert("点击取消或关闭按钮时执行方法");diag.close();}; diag.URL = "test.html"; diag.show();
var diag = new Dialog(); diag.Drag=false; diag.URL = "test.html"; 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('窗口尺寸改为600*300') ; doc.close(); diag.setSize(600,300); }; diag.show(); diag.okButton.value="改变窗口大小"
var diag = new Dialog(); diag.AutoClose=5; diag.ShowCloseButton=false; diag.URL = "javascript:void(document.write(\'这是弹出窗口中的内容\'))"; diag.show();注:AutoClose为自动关闭时间,单位秒
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.Title = "窗体内的按钮操作父Dialog"; diag.URL = "test.html"; diag.show(); var doc=diag.innerFrame.contentWindow.document; doc.open(); doc.write('') ; doc.close();