我有以下的GreaseMonkey腳本:的Greasemonkey:使用GM_xmlhttpRequest和createContextualFragment
GM_xmlhttpRequest({
method: 'GET',
url: "http://www.testurl.com",
headers: {
'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey/0.3',
},
onload: function(responseDetails) {
var tagString = responseDetails.responseText;
var range = document.createRange();
range.selectNode(document.body);
var documentFragment = range.createContextualFragment(tagString);
我現在該如何從DocumentFragment的提取東西? documentFragment.getElementById(''),document.body等全部返回undefined。
我懷疑這是由於createContextualFragment方法返回一個XPCNativeWrapper對象,但我如何解決這個問題以訪問底層的DOM?
感謝
哈哈,纔剛剛發現,是另一個你的問題:d – aland 2010-02-28 15:09:22