using this code:
<script src="<?php bloginfo('template_url'); ?>/scripts/hovermenus.js" type="text/javascript"></script>
to load this script
firebug is not showing this script as loaded, however, these scripts:
<script src="<?php bloginfo('template_url'); ?>/scripts/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="<?php bloginfo('template_url'); ?>/scripts/salf_ui.js" type="text/javascript"></script>
<script src="<?php bloginfo('template_url'); ?>/scripts/date.js" type="text/javascript"></script>
<script src="<?php bloginfo('template_url'); ?>/scripts/datePicker.js" type="text/javascript"></script>
all load perfectly well. I have double, triple and quadruple checked the file is in the right directory.
using this code:
<script src="<?php bloginfo('template_url'); ?>/scripts/hovermenus.js" type="text/javascript"></script>
to load this script
firebug is not showing this script as loaded, however, these scripts:
<script src="<?php bloginfo('template_url'); ?>/scripts/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="<?php bloginfo('template_url'); ?>/scripts/salf_ui.js" type="text/javascript"></script>
<script src="<?php bloginfo('template_url'); ?>/scripts/date.js" type="text/javascript"></script>
<script src="<?php bloginfo('template_url'); ?>/scripts/datePicker.js" type="text/javascript"></script>
all load perfectly well. I have double, triple and quadruple checked the file is in the right directory.
Share Improve this question edited Oct 20, 2010 at 20:59 Mild Fuzz asked Oct 20, 2010 at 20:48 Mild FuzzMild Fuzz 30.9k34 gold badges105 silver badges152 bronze badges 4- What does the rendered html look like? – Sean Vieira Commented Oct 20, 2010 at 20:49
- 2 The only difference I can see if the charset attribute on the one that doesn't work. Have you tried removng that? – Ian Devlin Commented Oct 20, 2010 at 20:51
-
And when you go to
<?php bloginfo('template_url'); ?>/scripts/hovermenus.js
does the script show up? – Sean Vieira Commented Oct 20, 2010 at 21:19 -
anything in your
Error Console
? have you checked thepermissions
of the file? – jrn.ak Commented Oct 20, 2010 at 21:21
7 Answers
Reset to default 1Looks like the problem is with your file
Make sure the file .../scripts/hovermenus.js
exists. Navigate there and copy paste the file name from there.
Could the script be in another directory? could it be hoverMenus.js
or hover.menus.js
.... etc.
If none of this works, try copying and renaming the file. See if you can load the renamed version. If you can't, it's something in the file.
Unrelated: You should declare your variables with var
so you don't create a bunch of global variables attached to window
.
You see these:
Why doesn't ASP.NET (3.5) always load an external javascript?
Firebug doesn't load JavaScript files or stop execution on breakpoints
charset isnt a valid attribute for the script tag, try removing it
EDIT
Actually it is valid, try removing it anyway :)
Make sure you've closed all your script tags above the one you're trying to load.
I had the similar problem: same file would not load on other pages(master pages)
original:
<script type="text/javascript" src="../../Scripts/scriptMob.js"></script>
fixed:
<script type="text/javascript" src="/Scripts/scriptMob.js"></script>
only removed dots and first slash
Additionally you can check in firebug(HTML section), expand the reference line
(+) <script src="../../Scripts/scriptMob.js" type="text/javascript">
to check whether browser actually reads the js file correctly.
the error message was saying: [SqlException]: Error converting data type nvarchar to int.
Had a similar problem, shoving my head against a wall trying to figure it out. Turned out the js file had a syntax issue buried in it, something stupid that didn't show in my editor ... in this case it was a hanging 'var ' with nothing after it. As soon as I deleted that, everything was copacetic.
So my remendation if you run into this is what I did - remove all functions and add them back one by one until you find one that kills it.
Had a similar problem, cant load script /js/search_ads.js It was problem in my adblock extension After renaming to search.js problem was disappearing