Şu anda bakım nedeniyle sitemiz kısıtlı işlevsellik sunmaktadır. Mevcut makaleler sorununuzu çözmediyse ve bize soru sormak isterseniz Twitter’da @FirefoxSupport hesabından ve Reddit’teki /r/firefox subreddit'inden destek gönüllülerimize ulaşabilirsiniz.

Mozilla Destek’te Ara

Destek dolandırıcılığından kaçının. Mozilla sizden asla bir telefon numarasını aramanızı, mesaj göndermenizi veya kişisel bilgilerinizi paylaşmanızı istemez. Şüpheli durumları “Kötüye kullanım bildir” seçeneğini kullanarak bildirebilirsiniz.

Daha Fazlasını Öğren

Firefox not calling javascript in external file

  • 1 yanıt
  • 4 kişi bu sorunu yaşıyor
  • 16 gösterim
  • Son yanıtı yazan: bbatl

more options

Firefox (version 22, I haven't tried this in earlier versions) cannot somehow find the reference to a .js file where my "dropdownmenu()" javascript function is located. Here is how I tested this: I created a "myalert()" function and a "dropdownmenu()" function that are both identical and look like this (just for testing purposes):

function myalert() { alert('javascript executed'); }

I put "myalert()" javascript on the aspx page itself. I put "dropdownmenu()" function in a separate .js file in the "scripts" folder. I tried the following two methods of referencing that .js script from the aspx page:

<script src="scripts/actionmenu.js" type="text/javascript"></script>

<script src="http://localhost/scripts/actionmenu.js" type="text/javascript"></script>

The aspx page has the two hrefs (to the two javascript functions) defined as follows:

<a href="javascript: dropdownmenu();" class="hovermenu" > My Options</a>

<a href="javascript: myalert();" class="hovermenu" > My Alert</a>

Clicking on "My Alert" works fine. So, if the javascript function is on the aspx page itself then everything works fine. Clicking on the My Options does nothing. So the javascript defined in a separate .js file does not get called.

Just to verify that I specified the correct location of the .js file, I opened the page in IE and clicked on My Options. It worked fine. It was able to find that "dropdownmenu()" function in my .js file. So the location of the .js file is definitely specified correctly but for some reason Firefox cannot find it or access it.

Firefox (version 22, I haven't tried this in earlier versions) cannot somehow find the reference to a .js file where my "dropdownmenu()" javascript function is located. Here is how I tested this: I created a "myalert()" function and a "dropdownmenu()" function that are both identical and look like this (just for testing purposes): function myalert() { alert('javascript executed'); } I put "myalert()" javascript on the aspx page itself. I put "dropdownmenu()" function in a separate .js file in the "scripts" folder. I tried the following two methods of referencing that .js script from the aspx page: <script src="scripts/actionmenu.js" type="text/javascript"></script> <script src="http://localhost/scripts/actionmenu.js" type="text/javascript"></script> The aspx page has the two hrefs (to the two javascript functions) defined as follows: <a href="javascript: dropdownmenu();" class="hovermenu" > My Options</a> <a href="javascript: myalert();" class="hovermenu" > My Alert</a> Clicking on "My Alert" works fine. So, if the javascript function is on the aspx page itself then everything works fine. Clicking on the My Options does nothing. So the javascript defined in a separate .js file does not get called. Just to verify that I specified the correct location of the .js file, I opened the page in IE and clicked on My Options. It worked fine. It was able to find that "dropdownmenu()" function in my .js file. So the location of the .js file is definitely specified correctly but for some reason Firefox cannot find it or access it.

Tüm Yanıtlar (1)

more options

I found somebody's suggestion on a different post to try reloading the page using "Ctrl-Shirt-r" to bypass cache. Yes, after doing that, the javascript popup window showed up correctly. However, this is not really a solution since I can't tell our customers to press "Ctrl-Shift-r" each time they get to this page.