demo.htm<input type="button" onclick="window.open('in.htm')" value="Open">
<input type="text" name="txt">in.htm<form name="form2">
1.<input type="checkbox" name="chk" value="1">
2.<input type="checkbox" name="chk" value="2">
3.<input type="checkbox" name="chk" value="3">
4.<input type="checkbox" name="chk" value="4">
5.<input type="checkbox" name="chk" value="5">
<br>
<input type="button" onclick="ChangeText()" value="添加">
</form>
<script>
function ChangeText()
{
var c = document.form2.chk;
var arr = new Array();
for(var i=0;i<c.length;i++)
{
if(c[i].checked)arr[arr.length]=c[i].value;
}
window.opener.document.all.txt.value = arr.join(",");
}
</script>
<input type="text" name="txt">in.htm<form name="form2">
1.<input type="checkbox" name="chk" value="1">
2.<input type="checkbox" name="chk" value="2">
3.<input type="checkbox" name="chk" value="3">
4.<input type="checkbox" name="chk" value="4">
5.<input type="checkbox" name="chk" value="5">
<br>
<input type="button" onclick="ChangeText()" value="添加">
</form>
<script>
function ChangeText()
{
var c = document.form2.chk;
var arr = new Array();
for(var i=0;i<c.length;i++)
{
if(c[i].checked)arr[arr.length]=c[i].value;
}
window.opener.document.all.txt.value = arr.join(",");
}
</script>
解决方案 »
- Spring求救,新手
- hibernate+spring+proxool,总是报java.lang.UnsupportedOperationException: The user must supply a JDBC con
- 请问OA系统中的内部信息交流该怎么做
- 在线等!在操作数据库是怎样弹出一个对话框
- jsp页面怎样向javascript传递字符串????
- 怎么把前一个页面动态的文本框里的值,在这个页面进行累加????
- 求助一道JAVA题目,着急,在线等,高手帮忙解决下,谢谢!
- XML在web开发中起到与数据库类似的功能,我认为用数据库方便, XML有胜过数据库的地方吗?
- 有关页面弹出窗口与用户交互使用问题
- 请给小妹妹一段完整的连接access数据库jsp代码(准确无误的),谢谢!
- ascii文件转化成propertise文件的那个命令是什么?
- 谁来给我网站看看病呀!??
function SetRole()
{
var strRoleIDList="";
var strValue="";
try
{
for(iIndex=0;iIndex<document.all.length;iIndex++)
{
if(document.all(iIndex).type=="checkbox")
{
if(document.all(iIndex).checked==true)
{
strValue=document.all(iIndex).id;
strRoleIDList=strRoleIDList+strValue.substr(strValue.indexOf("RoleID")+6)+",";
}
}
}
window.returnValue=strRoleIDList.substr(0,strRoleIDList.length-1);
}
catch(e)
{}
window.close();
}
document.all.FieldID.value=window.showModalDialog('','','')就可以了.
<input type="text" name="txt" readonly>
in.htm<form name="form2">
1.<input type="checkbox" name="chk" value="1">
2.<input type="checkbox" name="chk" value="2">
3.<input type="checkbox" name="chk" value="3">
4.<input type="checkbox" name="chk" value="4">
5.<input type="checkbox" name="chk" value="5">
<br>
<input type="button" onclick="ChangeText()" value="添加">
</form>
<script>
function window.onload()
{
var c = document.form2.chk;
var strPar = window.opener.document.all.txt.value;
var arrPar = strPar.split(",")
for(var i=0;i<arrPar.length;i++)
{
for(var k=0;k<c.length;k++)
{
if(c[k].value==arrPar[i])c[k].checked=true;
}
}
}
function ChangeText()
{
var c = document.form2.chk;
var arr = new Array();
for(var i=0;i<c.length;i++)
{
if(c[i].checked)arr[arr.length]=c[i].value;
}
window.opener.document.all.txt.value = arr.join(",");
}
</script>
<input type="text" name="txt1" readonly>
<br>
2.<input type="button" onclick="window.open('in.htm','txt2','')" value="Open">
<input type="text" name="txt2" readonly>
in.htm<form name="form2">
1.<input type="checkbox" name="chk" value="1">
2.<input type="checkbox" name="chk" value="2">
3.<input type="checkbox" name="chk" value="3">
4.<input type="checkbox" name="chk" value="4">
5.<input type="checkbox" name="chk" value="5">
<br>
<input type="button" onclick="ChangeText()" value="添加">
</form>
<script>
function window.onload()
{
var c = document.form2.chk;
//小技巧,利用window.open('in.htm','txt1','')的txt1为window.name
var strPar = window.opener.document.all[window.name].value;
var arrPar = strPar.split(",")
for(var i=0;i<arrPar.length;i++)
{
for(var k=0;k<c.length;k++)
{
if(c[k].value==arrPar[i])c[k].checked=true;
}
}
}
function ChangeText()
{
var c = document.form2.chk;
var arr = new Array();
for(var i=0;i<c.length;i++)
{
if(c[i].checked)arr[arr.length]=c[i].value;
}
window.opener.document.all[window.name].value = arr.join(",");
}
</script>