iframe父子窗口的相互调用

页面内的frame

 

<iframe name="countryFrame" src="country.jsp" mce_src="country.jsp" height="300" width="200" frameborder="0" > </iframe>

country.jsp

<input type="checkbox" name="checkbox" class="checkbox" id="CN-11" value="北京" onclick="objClick(this)"/> 北京 </li> <li> <input type="checkbox" name="checkbox" class="checkbox" id="CN-31" value="上海" onclick="objClick(this)"/> 上海 </li> <li> <input type="checkbox" name="checkbox" class="checkbox" id="CN-33" value="浙江" onclick="objClick(this)"/> 浙江 </li> <li> <input type="checkbox" name="checkbox" class="checkbox" id="CN-12" value="天津" onclick="objClick(this)"/> 天津 </li>

 

当前页面调用iframe指向的页面

//获得iframe内对象 var checkbox=window.frames['countryFrame'].document.getElementsByName("checkbox"); var geoCheckbox=0+","; for(var i=0;i<checkbox.length;i++){ //alert(checkbox[i].checked); if(checkbox[i].checked==true){ geoCheckbox+=window.frames['countryFrame'].document.getElementsByName("checkbox")[i].value+","; } }

 

iframe页面调用其上一级页面

 

window.parent.codeAddressWithParm(address);

调用上级的window.parent.codeAddressWithParm(address)函数

 

你可能感兴趣的:(iframe父子窗口的相互调用)