父窗体取 iframe 里的值

我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

 

你可能感兴趣的:(iframe)