Trang web này sẽ có chức năng hạn chế trong khi chúng tôi trải qua bảo trì để cải thiện trải nghiệm của bạn. Nếu một bài viết không giải quyết được vấn đề của bạn và bạn muốn đặt câu hỏi, chúng tôi có cộng đồng hỗ trợ của chúng tôi đang chờ để giúp bạn tại @FirefoxSupport trên Twitter và /r/firefox trên Reddit.

Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Tìm hiểu thêm

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!

Được chỉnh sửa bởi cor-el vào

Tất cả các câu trả lời (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.