`
ConeyLiu
  • 浏览: 128139 次
  • 性别: Icon_minigender_2
  • 来自: 重庆
社区版块
存档分类
最新评论

父窗体取 iframe 里的值

    博客分类:
  • WEB
 
阅读更多

我iframe里面是一个下拉框

在父窗体加入iframe

 <iframe src="getAllDistrict.html" name="searchFytIndividualReport_unit" id="searchFytIndividualReport_unit" width="300"  height="40" scrolling="no" frameborder="0"> </iframe>

 src 指向的就是通过action指向的下拉页面。

 

我在父窗口里面调用iframe下拉框的value 和text

var childValue= window.frames["searchFytIndividualReport_unit"].document.getElementById("districtSelect").value; //select value 
var selectObj= window.frames["searchFytIndividualReport_unit"].document.getElementById("districtSelect");  //select 对象
var childText =  selectObj.options[selectObj.selectedIndex].text;//select text 

 “searchFytIndividualReport_unit” 是指定某个iframe

"districtSelect"是iframe里面下拉的id

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics