Unable to load functions from external Javascript file

I have two functions which I want to call external. The two functions donot work however when I dump the functions into a single html doc is works. Is there something I'm missing. I swear I used to do this and it wasn't a problem. Ok First is html doc then external javascript file.

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>NHL Scoreboard</title>
<link rel="stylesheet" href="http://powerzsoftware.com/css/jquery-ui-1.8.9.customver1.css">
<style type="text/css">
.CENTERMID {	text-align: center;
	vertical-align: middle;
}
.WHITETEXT {
	font-family: "Times New Roman", Times, serif;
	font-size: 36px;
	font-weight: bold;
	color: #FFF;
	text-align: center;
	vertical-align: middle;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script>
<script src="development-bundle/jquery-1.4.4.js"></script>
 <script type="NHL.js"></script>       

<script type="text/javascript">
//var myVar = setInterval(loadData, 1000);
 
$(document).ready(function(){
	
         loadstats();
      
});

</script>
</head>

<body bgcolor="#000000">
<table width="750" border="0">
  <tr>
    <td width="100"><span class="CENTERMID"><img src="http://dev.sportsnetwork.com/aspdata/nhl2/IMAGES/Defaultlogo.png" alt="" name="imgaway" width="75" height="75" id="imgaway"></span></td>
    <td width="88" class="WHITETEXT" id="awayteamscore">0</td>
    <td width="341"><table width="100%" border="0">
      <tr class="GCPBP">
        <td width="17%"><div align="center" id="txtTime"></div></td>
        <td width="44%"><div align="center" id="txtPeroid"></div></td>
        <td width="10%"><div align="center">1</div></td>
        <td width="9%"><div align="center">2</div></td>
        <td width="10%"><div align="center">3</div></td>
        <td width="10%"><div align="center" id="so">OT</div></td>
      </tr>
      <tr>
        <td><div align="center"><span class="CENTERMID"><img src="http://dev.sportsnetwork.com/aspdata/nhl2/IMAGES/Defaultlogo.png" alt="" name="imgminiaway" width="32" height="32" id="imgminiaway"></span></div></td>
        <td bgcolor="#FFCC66"><div align="center" id="txtaway"></div></td>
        <td bgcolor="#FFFF99"><div align="center" id="periodA1"></div></td>
        <td bgcolor="#FFFF99"><div align="center" id="periodA2"></div></td>
        <td bgcolor="#FFFF99"><div align="center" id="periodA3"></div></td>
        <td bgcolor="#FFFF99"><div align="center" id="periodA4"></div></td>
      </tr>
      <tr>
        <td><div align="center"><span class="CENTERMID"><img src="http://dev.sportsnetwork.com/aspdata/nhl2/IMAGES/Defaultlogo.png" alt="" name="imgminihome" width="32" height="32" id="imgminihome"></span></div></td>
        <td bgcolor="#FFCC66"><div align="center" id="txthome"></div></td>
        <td bgcolor="#FFFF99"><div align="center" id="periodH1"></div></td>
        <td bgcolor="#FFFF99"><div align="center" id="periodH2"></div></td>
        <td bgcolor="#FFFF99"><div align="center" id="periodH3"></div></td>
        <td bgcolor="#FFFF99"><div align="center"></div></td>
      </tr>
      <tr class="GCPBP">
        <td colspan="6"><div align="center" id="txtLoc"></div></td>
      </tr>
    </table></td>
    <td width="107"><span class="CENTERMID"><img src="http://dev.sportsnetwork.com/aspdata/nhl2/IMAGES/Defaultlogo.png" alt="" name="imghome" width="75" height="75" id="imghome"></span></td>
    <td width="92" class="WHITETEXT" id="hometeamscore">0</td>
  </tr>
</table>
<table width="750" border="0">
  <tr class="GCPBP">
    <td><div align="center">Shots</div></td>
    <td><div align="center">Faceoff %</div></td>
    <td><div align="center">Hits</div></td>
    <td><div align="center">Penalties</div></td>
    <td><div align="center">PIM</div></td>
    <td><div align="center"></div></td>
    <td><div align="center">Shots</div></td>
    <td><div align="center">Faceoff %</div></td>
    <td><div align="center">Hits</div></td>
    <td><div align="center">Penalties</div></td>
    <td><div align="center">PIM</div></td>
  </tr>
  <tr>
    <td><div align="center" id="awayShots"></div></td>
    <td><div align="center" id="awayFO"></div></td>
    <td><div align="center" id="awayHits"></div></td>
    <td><div align="center" id="awayPenalties"></div></td>
    <td><div align="center" id="awayPIM"></div></td>
    <td><div align="center"></div></td>
    <td><div align="center" id="homeShots"></div></td>
    <td><div align="center" id="homeFO"></div></td>
    <td><div align="center" id="homeHits"></div></td>
    <td><div align="center" id="homePenalties"></div></td>
    <td><div align="center" id="homePIM">homePIM</div></td>
  </tr>
</table>
<script>
var myVar=setInterval(function(){myTimer()},2000);

function myTimer()
{

refreshsc();
}
</script>
</body>
</html>

Open in new window


Here is external

// JavaScript Document
var QueryString = function () {
	var query_string = {};
	var query = window.location.search.substring(1);
	var vars = query.split("&");
	for (var i=0;i<vars.length;i++) {
		var pair = vars[i].split("=");
		// If first entry with this name
		if (typeof query_string[pair[0]] === "undefined") {
			query_string[pair[0]] = pair[1];
		// If second entry with this name
		} else if (typeof query_string[pair[0]] === "string") {
			var arr = [ query_string[pair[0]], pair[1] ];
			query_string[pair[0]] = arr;
		// If third or later entry with this name
		} else {
			query_string[pair[0]].push(pair[1]);
		}
	} 
	return query_string;
} ();

function refreshsc() {
var xmlPath = '/xml/nhl/scores/real';
	 var xmlGameID = QueryString.gameID; 
$.ajax({
	 
        type: "GET",
        url:  xmlPath+"/"+xmlGameID+ ".xml",
        dataType: "xml",
        success: function(data) {
            var d = $(data);
            var Play = d.find('Play');
           
            var timeleft = Play.attr("TimeLeft")
            $(txtTime).html("Time Remaining" + "   "  + timeleft);
			var location = Play.attr("Location")
			$(txtLoc).html(location);
            d.find('Team').each(function(i,Team){
                var team = $(Team);
                var id = team.attr("ID").toLowerCase();
                var vh = team.attr('vh'); // A or H...
                var sHomeOrAway = vh == 'H' ? 'home' : 'away';
 			$('#img' + "mini" + sHomeOrAway).attr('src', 				'http://images.sportsnetwork.com/nhl/attherink/logos/' + team.attr('ID') + '.png');
                $('#img' + sHomeOrAway).attr('src', 'http://images.sportsnetwork.com/nhl/attherink/logos/' + team.attr('ID') + '.png');
               
            });
        }
    });
}
function loadstats() {
	var xmlPath = '/xml/nhl/scores/real';
	 var xmlGameID = QueryString.gameID; 
$.ajax({
	 
        type: "GET",
        url:  xmlPath+"/"+xmlGameID+ ".xml",
        dataType: "xml",
        success: function(data) {
            var d = $(data);
            var Play = d.find('Play');
           
            var timeleft = Play.attr("TimeLeft")
            $(txttime).html(timeleft);
			var location = Play.attr("Location")
			$(txtLoc).html(location);
            d.find('Team').each(function(i,Team){
                var team = $(Team);
                var id = team.attr("ID").toLowerCase();
                var vh = team.attr('vh'); // A or H...
                var sHomeOrAway = vh == 'H' ? 'home' : 'away';
 $('#' + sHomeOrAway + 'teamscore').html(team.find('Linescore').attr('Score'));

                team.find('LineQuarter').each(function(i2, oLQ){
                    $('#period' + vh + $(oLQ).attr('Prd')).html($(oLQ).attr('score'));
                });

                $('#txt' + sHomeOrAway + 'team').html(team.attr('Fullname'));
                $('#txt' + sHomeOrAway).html(team.attr('name'));

                var oTS = $(Team).find('TeamStats');
                $('#' + sHomeOrAway + 'Shots').html(oTS.attr('Shots'));
                $('#' + sHomeOrAway + 'FO').html(oTS.attr('FaceOffsPct') + '%');
                $('#' + sHomeOrAway + 'Hits').html(oTS.attr('Hits'));
                $('#' + sHomeOrAway + 'Penalties').html(oTS.attr('Penalties'));
				$('#' + sHomeOrAway + 'PIM').html(oTS.attr('PIM'));
				 });
        }
    });
}


 

Open in new window


Thanks EE
Tom PowersAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Tom BeckCommented:
You have this for the script include:  <script type="NHL.js"></script>

Should be:
 <script type="text/javascript" src="NHL.js"></script>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tom PowersAuthor Commented:
Thanks Tommyboy I have a follow up question I'll post rather then ask in this ticket. Thanks Again
Tom BeckCommented:
Fire away!

Thanks for the points.
Tom PowersAuthor Commented:
Tommy Boy I decided to experiment and I solved my follow up question.
Thanks again for the first one.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.