我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
本文介绍如何在父窗口中通过JavaScript操作iframe内的下拉框元素,包括获取选中的value和text值。
160

被折叠的 条评论
为什么被折叠?



