Forum Moderators: open
prolly not the best place to post this, but im hoping one of you clever chaps(esses) can help me out.
im just writing (trying to write) a crummy FF extension to do some things with a form in a page.. nothing spectacular, just showing form elements and values/names/ids.
but....
as alot of the time the page i am wanting to get at, is in a frameset, but i cant seem to set the document so that i can get at everything with getElementById etc..
i start with
var doc = window._content.document;
which happily sets 'doc' to what is needed, but this only works with NO frames.
so i tried this (partially lifted from someone elses extension) but cant seem to get my head around exactly how to get there..
doc = findFrame(doc, /pagename\.asp/i);
findFrame is as follows
function findFrame(doc,regexp){
var frames = doc.getElementsByTagName("frame"),i;
if (frames.length > 0 ){
for (i=0;i<frames.length;i++){
if (frames[i].document.location.href.search(regexp) > -1){
return frames[i].document;
}
}
}else{
return doc;
}
}
but this doesnt really do the trick, in fact, it seems to just miss completely.
now, im wondering if its somethign to do with how i am invoking the extensions script.. and as it happens its from the RightClick menu.
but once i have set the document to the correct frame doc then i am away, and can go home.. :)
any help much appreciated..
nat