a.html<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
</head><body>
<div id="showinput">
此处动态显示文本框
</div><input type="button" onclick="window.open('b.html','newwindow','height=100,width=400,top=0,left=0,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');" value="选择" /></body>
</html>b.html<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
</head><body>
<form method="post" name="form1">
<input type="checkbox" name="test" value="1" />选项一
<input type="checkbox" name="test" value="2" />选项二
<input type="checkbox" name="test" value="3" />选项三
<input type="button" value="确定" />
</form>
</body>
</html>新开窗口后根据复选框的选择结果动态在父页面创建文本框。
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
</head><body>
<div id="showinput">
此处动态显示文本框
</div><input type="button" onclick="window.open('b.html','newwindow','height=100,width=400,top=0,left=0,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');" value="选择" /></body>
</html>b.html<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
</head><body>
<form method="post" name="form1">
<input type="checkbox" name="test" value="1" />选项一
<input type="checkbox" name="test" value="2" />选项二
<input type="checkbox" name="test" value="3" />选项三
<input type="button" value="确定" />
</form>
</body>
</html>新开窗口后根据复选框的选择结果动态在父页面创建文本框。
解决方案 »
- JS根据TD的Id怎样获取Table的ID
- JS函数中用什么截取字符串
- 求完整百度搜索引擎的源代码
- 如何在ie中禁用JavaScript
- 如何防止(遨游Maxthon、世界之窗)之类浏览器问题
- JScript 中,我用FSO 是否可以操作别人的机器上的硬盘文件???
- 谁有在客户端把页面另存为word(excel)的java脚本,最好是butten触发
- 怎样用JavaScript打开SQL数据库
- 请问在javascript中new Option(str, str1)的详细用法,
- https怎么用js异步访问http页面?
- js按条件画斜线
- 求助,event 在IE6,ie7,ie8 下提示错误 event 不能为空
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<script>
function checks()
{
var chks=document.getElementsByName("test");
var val1="";val2="";
var count=0;
for(var i=0;i<3;i++)
{
for(var j=0;j<3;j++)
{
if(i==j || count>0)
{
continue;
}
if(chks[i].checked && chks[j].checked)
{
if(count==0)
{
val1=chks[i].value;
val2=chks[j].value;
count++;
break;
}
else
{
count++;
}
}
}
}
if(count!=1)
{
alert("必须勾选两个复选框!已勾选"+count+"");
return false;
}
var o_div=window.opener.document.getElementById("showinput");
o_div.innerHTML="<input type=text value='"+val1+"'><input type=text value='"+val2+"'>";
}
</script>
</head>
<body>
<form method="post" name="form1">
<input type="checkbox" name="test" value="1" />选项一
<input type="checkbox" name="test" value="2" />选项二
<input type="checkbox" name="test" value="3" />选项三
<input type="button" value="确定" onclick='checks()'/>
</form>
</body>
</html>