Firefox access to frames and forms in Javascript

T

troytabor

I was having an issue at www.logolounge.com where the form in the
bottom frame was no longer accessible through javascript in FireFox
1.5.0.8. I found the solution and wanted to share it. The previous
code, which no longer works in FireFox, to access the bottom frames
form is as follows:

function addBox(a) {
URL = "to_box.asp?a=" + a+ "&b=" +
top.bottomFrame.frmBoxNames.selID.options[top.bottomFrame.frmBoxNames.a.selectedIndex].value;
top.bottomFrame.location.href = URL
}

and the new, fully funcitoning in both IE and FireFox code is:

function addToLightbox(a) {
URL = "to_box.asp?a=" + a+ "&b=" +

top.frames[1].document.forms[0].selID.options[top.frames[1].document.forms[0].a.selectedIndex].value;
top.bottomFrame.location.href = URL
}

As you can see, I had to access the frames and forms arrays in order to
get it to work. The named frame (bottomFrame) properties are no longer
availalbe to me in FireFox.

Troy
 
A

ASM

(e-mail address removed) a écrit :
I was having an issue at www.logolounge.com where the form in the
bottom frame was no longer accessible through javascript in FireFox
1.5.0.8. I found the solution and wanted to share it. The previous
code, which no longer works in FireFox, to access the bottom frames
form is as follows:

function addBox(a) {
URL = "to_box.asp?a=" + a+ "&b=" +
top.bottomFrame.frmBoxNames.selID.options[top.bottomFrame.frmBoxNames.a.selectedIndex].value;
top.bottomFrame.location.href = URL

parent.bottomFrame.document. ...

you have forgotten "document" !
}

and the new, fully funcitoning in both IE and FireFox code is:

function addToLightbox(a) {
URL = "to_box.asp?a=" + a+ "&b=" +

top.frames[1].document.forms[0].selID.options[top.frames[1].document.forms[0].a.selectedIndex].value;
top.bottomFrame.location.href = URL
}

As you can see, I had to access the frames and forms arrays in order to
get it to work. The named frame (bottomFrame) properties are no longer
availalbe to me in FireFox.

Not at all : this time you address to the document of your frame !

Tried this which works fine (FF2) :

function look() {
var target = parent.middle.document.myForm.mySelect;
var k = target.selectedIndex;
var p = document.createElement('P');
p.innerHTML = target.options[k].text;
var place = parent.bottom.document.body;
place.appendChild(p);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top