I am a complete newbie to JS and really don't know what I'm diving into. I am trying to use a JS based internet speed test and have it run automatically on page load. I put the window.onload command at the end of the script, but I can't get passed the first instruction listed with in the function. Nothing else happens after the text regarding "test in progress" is displayed. I appreciate any help you folks can provide.

 	<script src="" type="text/javascript">
<h2>Rental Xpress Internet Speed Test</h2>

<button id="btnStart" type="button" onclick="btnStartClick()">Start Test</button>
<div id="msg"></div>
<script type="text/javascript">

	SomApi.account = "SOM5326f3c941ee5";   //your API Key here
	SomApi.domainName = "";      //your domain or sub-domain here 
	SomApi.config.sustainTime = 4; 
	SomApi.onTestCompleted = onTestCompleted;
	SomApi.onError = onError;

	var msgDiv = document.getElementById("msg");
	function btnStartClick() {
		msgDiv.innerHTML = "<h3>Speed test in progress. Please wait...</h3>";
	function onTestCompleted(testResult) {
		msgDiv.innerHTML = 
			"Download: " +"Mbps <br/>"+
			"Upload: "     +testResult.upload   +"Mbps <br/>"+
			"Latency: "    +testResult.latency  +"ms <br/>"+
			"Jitter: "     +testResult.jitter   +"ms <br/>"+
			"Test Server: "+testResult.testServer +"<br/>"+
			"IP: "         +testResult.ip_address +"<br/>"+
			"Hostname: "   +testResult.hostname +"<br/>"+
	function onError(error) {
		msgDiv.innerHTML = "Error "+ error.code + ": "+error.message;