
1.js在iframe子页面操作父页面元素代码:
window.parent.document.getElementByIdx_x("父页面元素id");
2.js在父页面获取iframe子页面元素代码如下:
window.frames["iframe_ID"].document.getElementByIdx_x("子页面元素id");
3. jquery在iframe子页面获取父页面元素代码如下:
$("#objid",parent.document)
4. jquery在父页面获取iframe子页面的元素
$("#objid",document.frames('iframename').document)
5. 在iframe中调用父页面中定义的方法和变量:(全局变量)
window.parent.window.parentMethod();
window.parent.window.parentValue;
6. 在父页面操作iframe子页面的方法和变量:(全局变量)
window.frames["iframe_ID"].window.childMethod();
window.frames["iframe_ID"].window.childValue;
7. 判断奇数偶数
10&1 0
11&1 1
11%2 1
11%1 0
8. 取整(舍弃小数)
3.5|0 3
-3.5|0 -1