alert(v)
obj.document.mytext.value = v;//就是这里报错了,说document的对象为空
window.close();------------------------------------------------------------------------------------ window.returnValue = v;
window.close();
obj.document.mytext.value = v;//就是这里报错了,说document的对象为空
window.close();------------------------------------------------------------------------------------ window.returnValue = v;
window.close();
这是什么东西啊?你这里的window对象是模态对话框对象吧,这怎么得到父窗口的test对象呢?
<html>
<head>
<script language="javascript">
function showkeyword(){
var HadData = window.showModalDialog('keyword.html','window','dialogwidth:200px;dialogheight:150px;resizable:yes;status:no;help:no;scroll:no"');
document.getElementById('mytext').value = HadData;}
</script>
</head>
<body>
<table width=500 border=1>
<tr><td width=50px><input type="button" id="show" onclick="showkeyword()" value="弹出知识点列表"></td></tr>
<tr><td><input type = "text" id ="mytext"></td></tr>
</table>
</body>
</html> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<script language="javascript">
var b = window.dialogArguments;
function test()
{ //这个函数的目的要把“知识点1”写到父窗口的text里面去
var v = document.getElementById("keyword1").innerText;
window.returnValue = v;//就是这里报错了,说document的对象为空
window.close();
}
</script>
</HEAD> <BODY>
<table>
<tr id = "keyword1"><td><a herf =# onclick= test()>知识点1</a></td><tr>
</table>
</BODY>
</HTML>