项目中使用到的父子窗体交互,仅有一个参数,想传递多个参数,其实有的人传多个字段的交互怎么办,其实很简单,既然一个都可传递对象,这个对象可以是复杂对象,但是如果你不想传递对js对象,可以传递json格式的字符串对象,也可以解决问题。
【parentWin.html】
<HTML>
<HEAD>
<SCRIPT>
var ReturnValue ="";
function fnOpen()
{
ReturnValue =window.showModalDialog("childWin.html","childWin","status:false;dialogWidth:300px;dialogHeight:300px");
if(ReturnValue!="")
{
document.frm0.txt0.value=ReturnValue;
}
}
function show_chlidWinParam()
{
//var ss = ReturnValue.split(",");
document.frm0.txt0.value=ReturnValue;
}
</SCRIPT>
</HEAD>
<BODY>
<form name=frm0>
<input type=button value="打开模式窗口" onclick="fnOpen();"/>
<input type="text" name="txt0" >
</form>
<BODY>
</HTML>
====================================================================
====================================================================
【childWin.html】
<script>
function choseItem()
{
var v="";
var check_item = document.frm.item;
for(i=0;i<check_item.length;i++)
{
if(check_item[i].checked)
{
v+=","+check_item[i].value;
}
document.frm.txt.value=v.replace(/^,{1}/,"");
}
}
function foo()
{
window.close();
// window.opener.document.getElementById("txt0").value=document.getElementById("txt").value
window.returnValue = document.getElementById("txt").value;
}
</script>
<body>
<form name=frm>
<input type=checkbox name=item value=1 onclick="choseItem();">a
<input type=checkbox name=item value=2 onclick="choseItem();">b
<input type=checkbox name=item value=3 onclick="choseItem();">c
<input type=checkbox name=item value=4 onclick="choseItem();">d
<input type=text name="txt">
</form>
<input type=button value="关闭" onclick="foo();">
</body>
相关推荐
This is a `window.showModalDialog()` shim using a modal HTML5 `<dialog>` element and ECMAScript 6 Generators. It was tested in the latest Google Chrome with the *Enable Experimental JavaScript* flag ...
window.showModalDialog以及window.open用法简介
针对window.showmodaldialog弹出窗体无刷新的详细使用
NULL 博文链接:https://shawnfree.iteye.com/blog/598885
javascript代码模块之\Window.ShowModalDialog使用手册
window.showModalDialog以及window.open用法简介
window.showModalDialog的基本用法
使用window.showModalDialog的程序员都知道,该方法可返回值。但是如果遇到跨域时,就返回为underfine。本文档通过iframe镶嵌页面解决该问题。
window.showModalDialog&&open.docx
javascript代码模块之window.showModalDialog方法的使用
主页面用window.showModalDialog的时候,如果直接打开其它系统的页面,这时候别人的页面在window.returnValue=1;这样返回值的时候,主页面是取不到返回值的,原因就是因为跨域了.
Window.ShowModalDialog使用手册_对话框 .txt 详细
JS 弹出对话框window.showModalDialog,级联方式,可以返回传值给页面
下面先说说window.showModalDialog的基本用法 showModalDialog() (IE 4+ 支持)...使用方法:vReturnValue = window.showModalDialog(sURL [, vArguments] [,sFeatures])vReturnValue = window.showModeles
关于struts2里用javascript刷新window.showModalDialog的父页面
本文实例讲述了js的window.showModalDialog及window.open用法。分享给大家供大家参考。具体分析如下: 一、window.open()支持环境: JavaScript1.0+/JScript1.0+/Nav2+/IE3+/Opera3+ 二、基本语法: window.open...
一个是window.showModalDialog()方法,后者是存在父子关系的一种弹出窗口,只有子窗关闭,父窗口才激活,并且可以传送参数和返回值。正好又温习一遍用法,顺便在此记录过程中遇到的问题。 基本介绍: ...