如何将另一帧窗口中的下拉框的值显示在本窗口中?

hubinasm 2002-06-19 01:03:23
如:<option selected value="2">sing</option>
在本窗口中显示为:sing
...全文
63 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
meizz 2002-06-19
  • 打赏
  • 举报
回复
接上补充:

document.all.input1.value=(ttt.options(ttt.selectedIndex).innerText);
若是改成:
document.all.input1.value=(ttt.options(ttt.selectedIndex).text);
这样也是对的。
chulian 2002-06-19
  • 打赏
  • 举报
回复
用request.form(表单元素)只能得到value值
而且需要提交及刷新页面
meizz 2002-06-19
  • 打赏
  • 举报
回复
在MenuFrame帧页中:
<select name=select1 size=1>
<option value="1">sing1</option>
<option value="2">sing2</option>
</select>

在MainFrame帧页中:
<input type=text name=input1><br>
<input type=button value=click onclick=cc()>

<script language="Javascript"><!--
function cc(){
var ttt = window.parent.MenuFrame.document.all.select1;
document.all.input1.value=(ttt.options(ttt.selectedIndex).innerText);
}
// --></script>

我测试通过
meizz 2002-06-19
  • 打赏
  • 举报
回复
在MenuFrame帧页中:
<select name=select1 size=1>
<option value="1">sing1</option>
<option value="2">sing2</option>
</select>

在MainFrame帧页中:
<input type=text name=input1><br>
<input type=button value=click onclick=cc()>

<script language="Javascript"><!--
function cc(){
var ttt = window.parent.MenuFrame.document.all.select1;
document.all.input1.value=(ttt.options(ttt.selectedIndex).innerText);
}
// --></script>

我测试通过
chulian 2002-06-19
  • 打赏
  • 举报
回复
用request.form(表单元素)只能得到value值
而且需要提交及刷新页面
marf_cn 2002-06-19
  • 打赏
  • 举报
回复
用request.form(表单元素)不行吗
chulian 2002-06-19
  • 打赏
  • 举报
回复
经meizz(梅花雨)提醒:
mainframe中:
<script language="Javascript"><!--
var ttt = document.parent.frames("MenuFrame").document.all("select1");
document.all("f1").value=ttt.options(ttt.selectedIndex).innerText;
// --></script>
meizz 2002-06-19
  • 打赏
  • 举报
回复
楼上的这位的方法比较好,不过有一个地方(selectedindex)写错了,应该是selectedIndex

mainframe中:
<script language="Javascript"><!--
var ttt = document.parent.frames("menuframe").document.all("select1");
alert(ttt.options(ttt.selectedIndex).innerText);
// --></script>
chulian 2002-06-19
  • 打赏
  • 举报
回复
opener.document.MenuFrame.select1.selectedIndex.value
<option selected value="2">sing</option>所在页面的帧为MenuFrame,选择框名为select1

mainframe中:
<script language="Javascript"><!--
var ttt = document.parent.frames("menuframe").document.all("select1");
alert(ttt.options(ttt.selectedindex).innerText);
// --></script>
meizz 2002-06-19
  • 打赏
  • 举报
回复
<option id=option1 selected value="2">sing</option>

在这个Frame中:
<input type=text name=f1>
<script language="Javascript"><!--
var ttt = window.parent.MenuFrame.document.all.option1;
if (ttt.selected)
document.all.f1.value = ttt.text
// --></script>
hubinasm 2002-06-19
  • 打赏
  • 举报
回复
一个页面分上下两个帧,上帧名为MenuFrame,下帧名为MainFrame.
opener.document.MenuFrame.select1.selectedIndex.value
<option selected value="2">sing</option>所在页面的帧为MenuFrame,选择框名为select1

我想在MainFrame中的子帧的子帧中显示MenuFrame中选择框select1中的值,如何
显示(我要显示sing)?
meizz 2002-06-19
  • 打赏
  • 举报
回复
哦!对不起,我上面这段代码有误,这样是只能得到value=2
meizz 2002-06-19
  • 打赏
  • 举报
回复
<input type=text name=f1>
<script language="Javascript"><!--
document.all.f1.value = window.parent.frame2name.document.all.selectname.value
// --></script>
hubinasm 2002-06-19
  • 打赏
  • 举报
回复
opener.document.MenuFrame.select1.selectedIndex.value
这样为什么不对?
<option selected value="2">sing</option>所在页面的帧为MenuFrame,选择框名为select1

急!!!

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧