Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

getElementById misses my element

3 views
Skip to first unread message

liv

unread,
May 15, 2010, 12:22:27 PM5/15/10
to
Hi guys,

I've a problem with an extension I'm writing that should make some changes
to DOM in a particular HTML page.
In a PC where Internet connection is particularly slow it works correctly,
but in another one where connection is fast I've a problem when I try to
identify an element by its ID (that for sure exists in the page).

Running this...

var tb = doc.getElementById('ctl00_CPMain_tblAdvanced').tBodies[0];

...my extension throws the error "Error:
doc.getElementById("ctl00_CPMain_tblAdvanced") is null".

The strange point is that I've registered in the following way an event
that launches a property, that then calls

var myext = {
init: function() {
...
appcontent.addEventListener("DOMContentLoaded", this.onPageLoad, false);
...
},
onPageLoad: function(ev) {
myext.changeBehaviour();

};

...


myext.changeBehaviour = function() {
var tb = doc.getElementById('ctl00_CPMain_tblAdvanced').tBodies[0];
...
};


Do you know what's wrong? If myext.changeBehaviour is called with the
event "DOMContentLoaded", how is possible that ctl00_CPMain_tblAdvanced is
not found if it is there (I see it using DOM inspector)?

I use Firefox 3.6.3.

Thanks and regards,

Livio

0 new messages