参数:
sUrl | : | 可选项。字符串(String)。指定要被加载的HTML文档的 URL 地址。假如无指定值,则 about:blank 的新窗口会被显示。 | ||||||||||||||||||||||||||||||||||||||||||
sName | : | 可选项。字符串(String)。 指定打开的窗口的名字。这个名字可以用于 form 或 a 对象的 TARGET 属性。此名字也可以使用下列通用名称:
| ||||||||||||||||||||||||||||||||||||||||||
sFeatures | : | 可选项。字符串(String)。 指定窗口装饰样式。使用下面的值。多个之间用逗号隔开。只有当新的浏览器窗口被建立时,此参数的设置才会发生作用。
| ||||||||||||||||||||||||||||||||||||||||||
bReplace | : | 可选项。布尔值(Boolean)。false | true
|
a.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>a.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<script type="text/javascript">
function selectKeHu(){
window.open("b.html","_blank","height=200,width=400,status=no,toolbar=no,menubar=no,location=no");
}
function addValue(value){
document.getElementById("userName").value = value;
}
</script>
</head>
<body>
选择客户<input type="text" name="userName" οnclick="selectKeHu()" id="userName">
</body>
</html>
b.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>b.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<script type="text/javascript">
function change(value){
window.opener.addValue(value);//获得a.html的引用,再调用a,html中的函数
}
</script>
</head>
<body>
<table>
<tr>
<td>法师</td>
<td><input type="button" value="选择" οnclick="change('法师')"></td>
</tr>
<tr>
<td>萨满</td>
<td><input type="button" value="选择" οnclick="change('萨满')"></td>
</tr>
</table>
</body>
</html>