标题:
关于怎样动态增加opener中select的option????
[打印本页]
作者:
fish
时间:
2006-5-20 16:29
标题:
关于怎样动态增加opener中select的option????
function select_item()
{
var qh=window.opener.document.all["DJZSXZQH"]
//clear options
for(var i=0;i<qh.length;i++)
{
qh.options
=null
}
//add option
qh.options[0]=new Option("AAAAA","BBBBBBB")
}
清除OPTIONS没有问题,但增加时报系统运行时错误,怎么回事??
作者:
恶梦
时间:
2006-5-20 16:30
<script>
function select_item()
{
var qh=window.opener.document.all("s")
//clear options
for(var i=0;i<qh.length;i++)
{
qh.options
=null
}
var n1=opener.document.createElement("OPTION")
n1,value="aaa"
n1.text="bbb"
qh.add(n1)
}
select_item()
</script>
作者:
eleven
时间:
2006-5-20 16:31
opener有关系:父窗口:
<form name=form1>
<select name=parentList>
<option>请选择
</select>
</form>
<script language=javascript>
function writeParentList(str)
{
if(str=="") return;
if(document.form1.parentList)
{
e = document.form1.parentList;
var newOP=new Option(str, str, true, true);
for(var i=0; i<e.options.length; i++) //不重复
if(e.options
.value == str) return;
e.options[e.options.length] = newOP;
}
}
</script>
<input type=button value=ok onclick="window.open('ttt.htm','meizz')">
子窗口:
<select onchange="if(window.name!='')opener.writeParentList(this.value)">
<option>请选择
<option value=aaa>aaa
<option value=bbb>bbb
<option value=ccc>ccc
<option value=ddd>ddd
<option value=eee>eee
</select>
作者:
thinking
时间:
2006-5-20 16:32
var oOption = document.createElement("OPTION");
oSelect.options.add(oOption);
oOption.innerText = "Two";
oOption.Value = "2";
欢迎光临 编程开发论坛 (http://bbs.lihuasoft.net/)
Powered by Discuz! 6.0.0