I have a problem with my current code. I am trying to test the number for null and if it is, it will cancel my loop. It seems to cancel with the current way i have it, but i need the number to add up with the previous one each time it loops. How can i test for null to cancel, while getting my number to add up?

Code:
<html>
<head>
	<script type="text/javascript"> 
			
	function nameInput()
...