2015年4月9日 星期四

自訂事件送到 iframe 裡面

因為 iframe 是為一個新的document 所以需要一些方法把事件送進去

index.html

$(document).contents().trigger( "scan_mode_event", [currentMode] );


ifame.html


parent.$(parent.document).bind( "scan_mode_event", function(event, currentMode){
if(currentMode==2){
$("#ppoe_option").show();
}else{
$("#ppoe_option").hide();
}
})

沒有留言:

張貼留言