Firefox does not support parent.frames['FRAME'].location.href='URL';
I cannot find a way of enabling Firefox to use this method which is supported by IE, Chrome & Safari. Or a way round.
I have a website made with frames and i need two frames to change on the click of one link, so i used a JavaScript function:
function change() { parent.frames['nav'].location.href='includes/nav-contact.htm'; parent.frames['body'].location.href='includes/contact.htm'; }
But no matter how i write it (based on articles saying firefox supports it; document.parent.frames, parent.document, window.document, window.parent. - all suggestions that do not work.
Please help?
تمام جوابات (8)
If you check Tools > Error Console, can you tell whether it is a syntax issue or a permissions issue?
This forum focuses on end-user support. You can find more web development help on the mozillaZine Web Development board. Separate forum, separate registration. Please note the tips in the Sticky Post at the top of the forum before posting.
I have 2 links, both with the same code, when click one i get this
Error: change2 is not defined Source File: javascript:change2() Line: 1
When i click the other, the first time i got two of this:
Error: uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIWebNavigation.loadURI]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: chrome://global/content/viewSource.js :: viewSource :: line 221" data: no]
Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIWebProgress.removeProgressListener]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://global/content/bindings/browser.xml :: removeProgressListener :: line 394" data: no]
followed by:
Error: change is not defined Source File: javascript:change() Line: 1
which is all i get from then onwards... Any idea?
I'd have to see the page to debug it further.
Regarding the "illegal value" try supplying a full URL rather than a relative URL.
The website address is: www.reactfunctionband.com
but i've also put the files into a zip folder so it can be opened in an editor and better understood.
www.reactfunctionband.com/FireFox Help Me.zip
Trying with the full links now...
Error: change is not defined Source File: javascript:change() Line: 1
Again... "/
When I throw out the stuff above the Javascript, it works.
I did some further tests, and just throwing out the useless and wrong "base target" line is sufficient to make it work.
You should really use doctype declarations to make that valid html. You'll make it much easier for browsers (and helpers) to make sense of your stuff. You should also always whittle everything down to the crucial parts. You can throw everything back in later...