Your js shoul be place on the end of your page for loading performance. (Like that the browser can start to render the web-page before the js has finished to load). But only if your Js is not mandatory for your Dom to load (it should be the case)
you can link them in two differents ways:
<script type="text/javascript">
//Here is your code
</script>
OR
<script type="text/javascript" src="url_of_your_js.js"></script>
EDIT
Be sure to include jquery:
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
</head>
If your code require the dom to be ready to be executed your should use
$(document).ready(function() {
//This is executed when dom is ready
});
The final result shoul look like this: (I put all In 1 file to be easier for you)
<html>
<head>
<style type"text/css">
.menu {
background: #3B6997;
font-weight: bold;
padding: 10px;
width: 300px;
display:none;
}
.menu a {
color: white;
}
.hov {
width: 300px;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.hov').hover(function() {
$('.menu').slideDown();
}, function() {
$('.menu').slideUp();
});
});
</script>
</head>
<body>
<div class="hov">
<a href="#">Activate Menu vv</a>
<ul class="menu">
<li>
<a href="#">Item</a>
</li>
</ul>
</div>
</body>
</html>
If you want to put yout js in separate file, let's say 'app.js', put this in this file:
$(document).ready(function() {
$('.hov').hover(function() {
$('.menu').slideDown();
}, function() {
$('.menu').slideUp();
});
});
You link it by putting this on your head section :
<script type="text/javascript" src="app.js"></script>
<script src="src.js"></script>