搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

Firefox does not support parent.frames['FRAME'].location.href='URL';

  • 8 个回答
  • 26 人有此问题
  • 12 次查看
  • 最后回复者为 Sum0

more options

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?

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)

more options

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.

more options

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?

more options

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.

more options

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...

more options

Error: change is not defined Source File: javascript:change() Line: 1

Again... "/

more options
more options
more options

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...