早上全部。我有如下因素的問題:將內容從iframe放入當前DOM
$(document).ready(function(){
$("#actContentToGet").load(function(){
var htmlCODE = document.getElementById('actContentToGet').contentWindow.document.body;
var elements = [];
var z = 1;
function alterContent(htmlCODE){
$("#createdDivs").html("");
htmlCODE.$("*").each(function(){
alert("w");
if($(this).attr("rel")!="nbta"){
var style = '#div' + z + ' style: ' + 'display:block; width:' + $(this).outerWidth(true) + 'px; height:' + $(this).outerHeight(true) + 'px; position:absolute; top:' + $(this).position().top + 'px; left:' + $(this).position().left + 'px; cursor:pointer; z-index:' + $(this).parentNumber() + ';';
var newDiv = '<div name="maskBox" id="div' + z + '" class="' + $(this).attr("id") + '" style="display:none;"> </div>';
$("#createdDivs").append(newDiv);
$("#div" + z).attr("style", style);
z++;
}
});
}
});
});
林不知道如何去了解這一點,但我希望能夠,如果你明白我的意思使用$("*").each()
使用來自iframe的內容?
我用htmlCODE.$("*").each(function(){
htmlCODE是不明確的
大加讚賞
右擊只要你知道這只是完整的代碼的片段,並調用該函數在其他地方 – 2009-12-13 10:24:24
我曾嘗試 'VAR htmlCODE =的document.getElementById(「actContentToGet」)。contentWindow.document。身體。的getElementsByTagName( 「*」); \t \t var z = 1; \t \t function alterContent(htmlCODE){ \t \t \t $(「#createdDivs」)。html(「」); \t \t \t $(htmlCODE)。每個(函數(){ \t \t \t \t警報( 「W」);' 至極的工作,但螢火蟲 '未捕獲的異常:[異常...「無法轉換的JavaScript參數arg 0「nsresult:」0x80570009(NS_ERROR_XPC_BAD_CONVERT_JS)「location:」JS frame :: http://localhost/www.actwebdesigns.co.uk(Aug2009)/ web-design-mansfield/jquery-user-interface-cms/js/jquery-1.3.1.js :: anonymous :: line 797「data:no] Line 0' – 2009-12-13 10:49:16
**其中有效,但螢火蟲發生錯誤** – 2009-12-13 10:50:13