Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

Zoeken in Support

Vermijd ondersteuningsscams. We zullen u nooit vragen een telefoonnummer te bellen, er een sms naar te sturen of persoonlijke gegevens te delen. Meld verdachte activiteit met de optie ‘Misbruik melden’.

Meer info

Deze conversatie is gearchiveerd. Stel een nieuwe vraag als u hulp nodig hebt.

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!

Bewerkt door cor-el op

Alle antwoorden (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.