iframe相互取值

1.情况:一个页面(父页面p)里加载了两个iframe子页面(fa和fb)
bgcolor="b5d6e6" onmouseover="changeto()" onmouseout="changeback()">
src="/private/membermanage/consume/consume_left.jsp">
src="/private/membermanage/consume/consume_right.jsp">
取值1:父页面获取子页面的值
var doc=window.frames["fa"].document;
var pk_goods_info = doc.getElementsByName("pk_goods_info");
var goods_quantity = doc.getElementsByName("goods_quantity");

取值2:子页面获取父页面的值,并赋值(子页面操作父页面)
var doc=parent.document;
doc.getElementById("consume_money").value=consume_money;

取值3:两个子页面相互操作(fb操作fa)
var doc= parent.frames['fa'].document;
doc.getElementById("rate"+count).value=rate;

你可能感兴趣的:(iframe)