Този сайт ще има ограничена функционалност, докато се извършва тече неговата поддръжка. Ако дадена статия не може реши проблема ви и искате да зададете въпрос, нашата общност е готова да ви помогне на @firefox в Twitter и /r/firefox в Reddit.

Търсене в помощните статии

Избягвайте измамите при поддръжката. Никога няма да ви помолим да се обадите или изпратите SMS на телефонен номер или да споделите лична информация. Моля, докладвайте подозрителна активност на "Докладване за злоупотреба".

Научете повече

Javascript: parent.framename.document.forms[i].elements.length

more options

I have a PHP-Script 1 with an iframe. In this iframe an other PHP-Script 2 is loaded, which contains several forms. In one of this forms I make a call by button with onclick="..." to a javascript-function. The javascript-function is contained in an external file *.js. Declaration in PHP-Script 2: <Script type="text/javascript" src="WartArtikel-Probe.js"></Script>. Inside the javascript-function I use: Scenario 1: var i = 0; var anzelem = parent.framename.document.forms[i].elements.length; or: var anzelem = parent.frames[0].document.forms[i].elements.length; or: var anzelem = window.document.forms[i].elements.length;

When I press the button, the javascript-function gives no answer. But when I start PHP-Script 2 directly (not inside an iframe) and the javascript-function is written as: Scenario 2: var i = 0; var anzelem = document.forms[i].elements.length; this example works! How can I get an answer in scenario 1?

Additional suggestion: Is it possible to switch the browser into a development-modus, where javascript-syntax-errors are displayed? This could be very helpful!

I have a PHP-Script 1 with an iframe. In this iframe an other PHP-Script 2 is loaded, which contains several forms. In one of this forms I make a call by button with onclick="..." to a javascript-function. The javascript-function is contained in an external file *.js. Declaration in PHP-Script 2: &lt;Script type="text/javascript" src="WartArtikel-Probe.js"&gt;&lt;/Script&gt;. Inside the javascript-function I use: Scenario 1: var i = 0; var anzelem = parent.framename.document.forms[i].elements.length; or: var anzelem = parent.frames[0].document.forms[i].elements.length; or: var anzelem = window.document.forms[i].elements.length; When I press the button, the javascript-function gives no answer. But when I start PHP-Script 2 directly (not inside an iframe) and the javascript-function is written as: Scenario 2: var i = 0; var anzelem = document.forms[i].elements.length; this example works! How can I get an answer in scenario 1? Additional suggestion: Is it possible to switch the browser into a development-modus, where javascript-syntax-errors are displayed? This could be very helpful!

Променено на от cor-el

Всички отговори (1)

more options

To view script errors, you can keep the Browser Console open in a separate window. To open that, you can use either:

  • Ctrl+Shift+j
  • "3-bar" menu button > Developer > Browser Console
  • Tools menu > Web Developer > Browser Console

My guess is you will find some kind of security related issue.