2010-07-14 50 views
1

我試圖找出什麼是jQuery的等同於以下代碼:與這些javascript DOM對象/方法相當的jQuery是什麼?

var temp = $('#logoutFrame2').contents().find('html').html(); 

try { 
    var temp1 = document 
        .getElementById('logoutFrame2') 
        .contentWindow 
        .document 
        .getElementById('theCBOBox').innerHTML; 
} 
catch(err){} 

var newdiv = document.createElement("div"); 
newdiv.innerHTML = temp; 
var container = document.getElementById("theContacts"); 
container.appendChild(newdiv); 

任何幫助將是巨大的! :O)

大衛

+1

.......但是爲什麼? – 2010-07-14 07:39:16

+0

這段代碼的哪部分你想改成jquery? – Zsolti 2010-07-14 07:47:22

+0

所有這些都是預期的,因爲我已經做了那個。 – StealthRT 2010-07-14 07:52:57

回答

1
var temp = $('#logoutFrame2').contents().find('html').html(); 

    try { 
     var temp1 = document 
         .getElementById('logoutFrame2') 
         .contentWindow 
         .document 
         .getElementById('theCBOBox').innerHTML; 
    } 
    catch(err){} 

    var newdiv = document.createElement("div"); 
    newdiv.innerHTML = temp; 
    var container = document.getElementById("theContacts"); 
    container.appendChild(newdiv); 

轉化爲

var temp = $('#logoutFrame2').contents().find('html').html(); 

    try 
    { 
     var temp1 = $('#logoutFrame2')[0].contentWindow.document.getElementById('theCBOBox').innerHTML; 
    } 
    catch(err){} 

    $('#theContacts').append('<div>'+temp+'</div>'); 

享受!

+0

工作,波格丹:o)謝謝! – StealthRT 2010-07-14 07:56:32

相關問題