Hi there,
Can anyone explain what is wrong with my code? I get an error message saying null value from innerHTML.
<script type="text/javascript">
var sub1 = document.getElementById("input1") ;
var sub2 = document.getElementById("input2") ;
var sub3 = document.getElementById("input3") ;
var sub4 = document.getElementById("input4") ;
var GPA = (sub1+sub2+sub3+sub4)/4;
var para = document.getElementById("para");
para.innerHTML = GPA;
//document.writeln(s);
</script>
</head>
<body>
<form id="calculator">
Subject 1 : <input type="text" id="input1" value="10" > <br/>
Subject 2 : <input type="text" id="input2" value="20"> <br/>
Subject 3 : <input type="text" id="input3" value="30"> <br/>
Subject 4 : <input type="text" id="input4" value="40"> <br/>
<input type="text" id="para" >
<input type="submit" value="Calculate">
</form>
</body>
</html>