Connecting Tech Pros Worldwide Forums | Help | Site Map

Compatibility issue while accessing the objects...

mehdi_mousavi
Guest
 
Posts: n/a
#1: Mar 3 '06
Hi folks,
The following code works fine under IE, but it doesn't work under
firefox:

var wnd = parent.frames["rtop"], link = '';

//initialize link variable...
//removed for clarity...

wnd.m_ctrlNavBar.innerHTML = unescape(link);

where m_ctrlDiv, as it sounds, points to a "div" element specified on
"wnd" page. I would like to know how am I supposed to access
m_ctrlNavBar element in FireFox?

Any help would be highly appreciated,
Cheers,
Mehdi


Amie
Guest
 
Posts: n/a
#2: Mar 3 '06

re: Compatibility issue while accessing the objects...


I had a similiar situation once, and it was with iframes.. Basically I
had to access a DOM object in a given iframe, and the following helped
with both browsers:

var iframeNav = top.document.getElementById('iframeNavigation');
var iframeNavDoc;

if (iframeNav.contentDocument) {
iframeNavDoc = iframeNav.contentDocument;
} else if (iframeNav.contentWindow) {
iframeNavDoc = iframeNav.contentWindow.document;
} else if (iframeNav.document) {
iframeNavDoc = iframeNav.document;
}
if (iframeNavDoc) {
if (iframeNavDoc.getElementById('somevalue')) {
iframeNavDoc.getElementById('somevalue').className =
'menuItem';
}
}

Hope it helps,
Amie

Closed Thread