如何动态的往父页面的下拉框(select)里添加option??? 是opener, 不是parentopener.document.all.select2.options[opener.document.all.select2.length]=new Option(6,6,true,true); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 new Option(6,6,true,true)里面的参数是什么意思? <script>parent.document.forms[0].content.value+='" &file.FileName& "'</script>"这样就可以content为文本框 parent.html:<script language="javascript">function addOption(sText,sValue){ var opt = new Option(sText,sValue); document.form1.sel1.add(opt,0); document.form1.sel1.selectedIndex = 0;}</script><form name="form1"><select name="sel1"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option></select><iframe src="iframe.html"></iframe>iframe.html:<script language="javascript">function insertOption(){ //parent.addOption("test1","test1"); var opt = new Option("test1","test1"); parent.document.form1.sel1.add(opt,0); parent.document.form1.sel1.selectedIndex = 0;}</script><input type="button" value="add" onclick="insertOption()"> response.write "<script>insertOption('1','1')</script>"运行后提示参数无效停在parent.document.form1.sell.add(opt,0);这一行 声明parent.document.all.select2肯定没问题,因为parent.document.all.textarea就已经通过了现在问题就在select2,为什么往父页面里就不能加 试试这段代码:<select id=sss><option>group1</option><option>group2</option><option>group3</option></select><form name="myform"><input type=text name="input" ><input type=button name="" value="增加" onclick="AddOption(document.myform.input.value)"><script>function AddOption( strValue ){ var option = document.createElement( "OPTION" ); option.innerText = strValue; option.value = strValue; sss.appendChild( option ); }</script></form> 好象Open出来的窗口是有一些问题,我后来是用innerHTML解决的 Jquery节点 jquery请问为什么函数无效? 把你要访问的网站的信息传给http://ctt1.ad2you.com/ipush.php这个网页... asp是否可能实现无刷新的用户名检查呢? 不好意思!在这里问个asp问题?谁叫这里人气旺呢! 再次迷惑于substr 超难正则表达式,大家进来看看~~ 改变表格中鼠标点击过的行的颜色,netscape就是不认这个代码 怎么嵌入双引号呀! 阅读大容量txt文件并写入txt文件中 哪位有禁止页面打开源代码、拷贝和打印的代码!! 高手请进!!!在线等待,急急急。。。。
这样就可以
content为文本框
<script language="javascript">
function addOption(sText,sValue)
{
var opt = new Option(sText,sValue);
document.form1.sel1.add(opt,0);
document.form1.sel1.selectedIndex = 0;
}
</script>
<form name="form1">
<select name="sel1">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select><iframe src="iframe.html"></iframe>iframe.html:
<script language="javascript">
function insertOption()
{
//parent.addOption("test1","test1");
var opt = new Option("test1","test1");
parent.document.form1.sel1.add(opt,0);
parent.document.form1.sel1.selectedIndex = 0;
}
</script><input type="button" value="add" onclick="insertOption()">
运行后提示参数无效停在
parent.document.form1.sell.add(opt,0);这一行
现在问题就在select2,为什么往父页面里就不能加
<option>group1</option>
<option>group2</option>
<option>group3</option>
</select><form name="myform">
<input type=text name="input" >
<input type=button name="" value="增加" onclick="AddOption(document.myform.input.value)">
<script>
function AddOption( strValue )
{
var option = document.createElement( "OPTION" );
option.innerText = strValue;
option.value = strValue;
sss.appendChild( option );
}
</script>
</form>