- 爱易网页
-
JavaSript
- 请教,怎么将子页面option值全部传递给父页面的text
日期:2014-05-16 浏览次数:20357 次
请问,如何将子页面option值全部传递给父页面的text?
父页面代码:
<!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 name= "form1 " id= "form1 " method= "post " action= " ">
<input name= "userid " type= "text " id= "userid " value= " " />
<a href= "# " onclick= "window.open( 'friendlist.htm ', 'newwindow ', 'height=380, width=600, top=10, left=200, top=60, toolbar=no, menubar=no, scrollbars=yes,resizable=no,location=no, status=no ') "> 选择名单 </a>
</form>
</body>
</html>
子页面friendlist.htm代码:
<!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>
<style type= "text/css ">
<!--
* {
margin:0;
border:0;
padding:0;
}
body {
font:12px Arial;
background:#fff;
color:#333;
}
td {
padding:5px;
}
.list {
color:#333;
width:120px;
font:12px/20px Arial;
background:#fff;
}
.button {
display:block;
width:61px;
line-height:19px;
text-align:center;
background:url(images/button1.gif) no-repeat;
color:#000;
text-decoration:none;
}
.button1 {
width:73px;
font:12px/22px Arial;
text-align:center;
background:url(images/button6.gif) no-repeat;
color:#000;
text-decoration:none;
}
-->
</style>
</head>
<body>
<script language= "JavaScript ">
function copyToList(from,to) //from表示:包含可选择项目的select对象名字 to表示:列出可选择项目的select对象名字
{
fromList = eval( 'document.forms[0]. ' + from);
toList = eval( 'document.forms[0]. ' + to);
if (toList.options.length > 0 && toList.options[0].value == 'temp ')
{
toList.options.length = 0;