$('#htmlTempleteOfIframe1 > iframe').load(function(){
var str = $('#htmlTempleteOfIframe1 > iframe').contents().find('body').find("div:nth-child(3)").find("table:nth-child(2)").find("tbody").find("tr").find("td:nth-child(2)").find("a").html();
var arr = str.split('<br>');
var lindao = new Array();
var baiban = new Array();
var yeban = new Array();
var quantian = new Array();
for(var i=1;i<arr.length-1;i++){
if('领导'==arr[i].split(':')[0]){
lindao.push('带班领导:'+arr[i].split(':')[1]);
}
else if('白班'==arr[i].split(':')[0]){
baiban.push(arr[i]);
}
else if('夜班'==arr[i].split(':')[0]){
yeban.push(arr[i]);
}
else{
quantian.push(arr[i]);
}
}
var temp = $.merge(lindao, baiban);
temp = $.merge(temp, yeban);
temp = $.merge(temp, quantian);
$('#htmlTempleteOfIframe1 > iframe').contents().find('body').find("div:nth-child(3)").find("table:nth-child(2)").find("tbody").find("tr").find("td:nth-child(2)").find("a").html('今日值班:<br>'+temp.join('<br>'));
});
1.加载iframe框架内容 load() contents()
$('#htmlTempleteOfIframe1 > iframe').load(function(){
var str = $('#htmlTempleteOfIframe1 > iframe').contents().find('body').find("div:nth-child(3)").find("table:nth-child(2)").find("tbody").find("tr").find("td:nth-child(2)").find("a").html();
});
2. 数组合并
var temp = $.merge(lindao, baiban);
3. 数组输出
temp.join('<br>')