javascript代码:实现把弹出窗口的下拉框列表的值传递给父级页面的文本框中。
展开全部
父窗口:<!--文件名:1.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=utf-8" />
<title>无标题文档</title>
<script LANGUAGE="JavaScript">
function openwin() {
window.open ("2.html", "newwindow2", "height=100, width=200, top=100, left=100,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no")
}
</script>
</head>
<body onload="openwin()">
<input name="" type="text" id="ipt"/></body>
</html>
弹出窗口:<!--文件名:2.html-->
<body>
<select name="sel" size="1" onchange="selchg(this.options[this.selectedIndex].value)">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<script>
var par = window.opener;
function selchg(v){
window.opener.document.getElementById("ipt").value = v;
}
</script>
</body>
<!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=utf-8" />
<title>无标题文档</title>
<script LANGUAGE="JavaScript">
function openwin() {
window.open ("2.html", "newwindow2", "height=100, width=200, top=100, left=100,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no")
}
</script>
</head>
<body onload="openwin()">
<input name="" type="text" id="ipt"/></body>
</html>
弹出窗口:<!--文件名:2.html-->
<body>
<select name="sel" size="1" onchange="selchg(this.options[this.selectedIndex].value)">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<script>
var par = window.opener;
function selchg(v){
window.opener.document.getElementById("ipt").value = v;
}
</script>
</body>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询