showModalDialog 访问父窗口,向父窗口返回值及undefined类型判断,js触发服务器控件事件
2012-11-21 16:01
666 查看
访问父窗口:
——子窗口:返回FIELD_ID值,之后子窗口关闭
window.document.getElementByID("服务器控件ID").value=值
注:为value赋值时,当心控件本就没有value属性,那会没用的
IE6中的showModelDialog中,<base target="_self" />不能直接在<head>下面,否则会报"xxxxx不能打开Interner站点,xxxxxxx"
var parent=window.dialogArguments; // 父页面路径 //frmAction.ActionReturnURL.value = parent.location; // 父页面表名--导出页面所需的参数 var TableName=parent.document.getElementsByName("TableName")[0].value; // 父页面记录条数 var dcjet_RowCount=parent.document.getElementsByName("dcjet_RowCount")[0].value; // 父页面查询条件 var dcjet_CommonWhere=parent.document.getElementsByName("dcjet_CommonWhere")[0].value; // 导出字段 var FIELD_ID = getSelectList(document.all[strIDFieldName]); // 排序 var OrderBy=parent.document.getElementsByName("OrderBy")[0].value; // 查询 var Filter=parent.document.getElementsByName("Filter")[0].value; // 版本 var Version=parent.document.getElementsByName("Version")[0].value; // 文件名 var FileName=parent.document.getElementsByName("FileName")[0].value; // 页面ID var ReportID=parent.document.getElementsByName("ReportID")[0].value; // 模块名 var ModelName=parent.document.getElementsByName("ModelName")[0].value; // StartRows var StartRows=parent.document.getElementsByName("StartRows")[0].value; // ActionReturnURL var ActionReturnURLa=parent.location.toString();//parent.document.getElementsByName("ActionReturnURL")[0].value; ActionReturnURL=ActionReturnURLa.replace(/&/g, "%26"); // ActionReturnURLa="http://localhost/TCms/Admin/BillManage/BillVindicate/Index.aspx?ReportID=8501&IE_FLAG=I&G_MARK=3" // ActionReturnURL=ActionReturnURLa.replace(/&/g, "%26");//正则表达式将&包含在路径中传递 // 改变父窗口路径 window.dialogArguments.location = "<%=Request.ApplicationPath %>/IEData/ExportDB_Common.aspx?isTemplate=1&TableName="+TableName+"&dcjet_RowCount="+dcjet_RowCount+"&dcjet_CommonWhere="+dcjet_CommonWhere +"&FIELD_ID="+FIELD_ID+"&OrderBy="+OrderBy+"&Filter="+Filter+"&Version="+Version+"&FileName="+FileName+"&ReportID="+ReportID+"&ModelName="+ModelName+"&StartRows="+StartRows+"&ActionReturnURL="+ActionReturnURL;undefined类型判断:需要用typeof
if (typeof (returnResult) != "undefined") { window.document.getElementById("txtExportReportID").value = returnResult; window.document.getElementById("btnTxtHidden").click(); }向父窗口返回值:
——子窗口:返回FIELD_ID值,之后子窗口关闭
window.returnValue=FIELD_ID; window.close();——父窗口:用returnResult去接受返回值
var returnResult = showModalDialog(url, window,"help:No;resizable:No;status:No;scroll:yes");js触发服务器控件事件及赋值:
window.document.getElementByID("服务器控件ID").value=值
注:为value赋值时,当心控件本就没有value属性,那会没用的
window.document.getElementById("txtExportReportID").value = returnResult; window.document.getElementById("btnTxtHidden").click();
IE6中的showModelDialog中,<base target="_self" />不能直接在<head>下面,否则会报"xxxxx不能打开Interner站点,xxxxxxx"
相关文章推荐
- JS触发服务器控件的单击事件
- 让某些服务器控件触发事件时,先调用js函数,在调用后台函数代码
- JS触发服务器控件的单击事件
- JS触发服务器控件的单击事件(详解)
- 笔记:JS捕捉键盘事件(Enter),触发服务器控件(Button)事件。
- js判断undefined类型
- js 判断浏览器类型 去全角、半角空格 自动关闭当前窗口
- js判断undefined类型
- js用typeof方法判断undefined类型
- JS 触发服务器事件
- js判断undefined类型,undefined,null,NaN的区别
- DataGridView中对各种类型的单元格控件的事件处理(DataGridViewCheckBoxCell、DataGridViewComboBoxCell等的选定、事件触发)
- js判断undefined类型
- js类型判断(数字、0、""、undefined、null)
- js获取服务器生成并返回客户端呈现给客户的控件id的方法
- JS 判断 undefined 类型
- [置顶] js 触发事件种类类型有哪些?
- [Javascript]js判断是否为undefined类型
- JS对输入判断变化屏蔽中文输入法输入时连续触发事件的方法
- js监听返回事件,返回直接关闭窗口事件(微信网页返回关闭)