Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Not loading external .js file

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #29361
    ak209
    Participant

    I’m working on a simple unordered list style menu within a <div id="top_nav">. Where I’m running into an issue is within the head, I call to reference

    Quote:
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js&quot; type="text/javascript"></script>

    then underneath reference a secondary .js file

    Quote:
    <script src="scripts/nav_delay/nav_delay.js" type="text/javascipt"></script>

    then when I preview the file the desired js. effect does not work. BUT..

    When I substitute the secondary .js reference for;

    Quote:
    <script language="javascript">
    var timeout = 900;
    var closetimer = 0;
    var ddmenuitem = 0;

    function top_nav_open()
    { top_nav_canceltimer();
    top_nav_close();
    ddmenuitem = $(this).find(‘ul’).css(‘visibility’, ‘visible’);}

    function top_nav_close()
    { if(ddmenuitem) ddmenuitem.css(‘visibility’, ‘hidden’);}

    function top_nav_timer()
    { closetimer = window.setTimeout(top_nav_close, timeout);}

    function top_nav_canceltimer()
    { if(closetimer)
    { window.clearTimeout(closetimer);
    closetimer = null;}}

    $(document).ready(function()
    { $(‘#top_nav > li’).bind(‘mouseover’, top_nav_open)
    $(‘#top_nav > li’).bind(‘mouseout’, top_nav_timer)});

    document.onclick = top_nav_close;
    </script>

    and embed it directly withing the page, it runs fine. I’ve tried with both relative and absolute file paths, too.. but still nada.

    Does anyone have any ideas?

    Thanks in advance.

    #77818
    jamygolden
    Member

    I’m pretty sure it’s because you are giving an incorrect path. Do you have a working link? http://css-plus.com/2010/03/6-steps-to-take-if-your-jquery-is-not-working/

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.