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

相关问题