external file

external file

Hi, I am trying to put my code into an external file so i can use it in multiple pages

here is the code:
// back to top
var button = $('#back-top');
// fade in button
if ($(this).scrollTop() > 600) {
} else {
// scroll body to 0px on click
$('#back-top a').on('click' , function(){
$('body,html').animate({scrollTop: 0}, 600); return false;

it works fine normally, but when put into an external file it wont work

heres how I have called the external file (called scroll.js):
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="js/scroll.js"></script>

what am i doing wrong???????