treehouse : what would you like to learn today?
Web Design Web Development iOS Development

java doesn't work

  • I cant see where's the problem here... The javascript doesn't work at all

    I just started learning javascript and I made my first functsion.

    HTML:

    <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
    <html xmlns=\"http://www.w3.org/1999/xhtml\">
    <head>
    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
    <title>jQuery</title>
    <script src=\"http://localhost/jquery/js/jquery-1.3.2.min.js\" type=\"text/javascript\"></script>
    <script src=\"http://localhost/jquery/js/funktsioonid.js\" type=\"text/javascript\"></script>
    <link rel=\"stylesheet\" type=\"text/css\" href=\"css/stiil.css\" />
    </head>
    <body>
    <div id=\"kast\"></div>
    <a href=\"#\">Vajuta mind!</a>
    </body>
    </html>


    CSS :

    * {
    margin: 0;
    padding: 0;
    font-family: Tahoma, Geneva, sans-serif;
    font-size: 12px;
    }

    /* Haihtuv kast */
    #kast {
    background: #000;
    height: 300px;
    width: 300px;
    }


    javascript:

    $(function() {
    $('a').click(function() {
    $('#kast').fadeout(5000);
    });
    });



    The addresses are right...
  • Use firebug. Is jQuery loading?
    The paths don't look right to me, but it's your directory structure.
  • I rechecked the addresses. All match.

    How can I use firebug fof checking and what should I check with it? And how do i know if the jquery loads?

    Do I have to tell the js document where the jQuery is situated?
  • How can I use firebug fof checking and what should I check with it? And how do i know if the jquery loads?

    In firebug click the dropdown next to head, then click the dropdown next to the jQuery link. If jQuery is loading you will see the jQuery script there.

    It is not necessary to use absolute urls, relative will do fine.