Commits

gudjonsen committed c0c9ce4

No jquery required ;)

  • Participants
  • Parent commits a90e041

Comments (0)

Files changed (1)

  * c = verð pr ltr
  */
 
-function verd(a, b, c)
-{
-	return b / 100 * a * c
-}
+window.onload = function(){
+	document.getElementById('formid').onSubmit = function(){
 
-function eydsla(a, b)
-{
-	return b / 100 * a;
-}
+		var a = (document.getElementById('a').value).replace(/,/, '.');
+		var b = (document.getElementById('b').value).replace(/,/, '.');
+		var c = (document.getElementById('c').value).replace(/,/, '.');
 
-$(document).ready (function()
-{
-	$("#formid").submit(function()
-	{
-		return false;
-	});
-	
-	$("#takki").click(function()
-	{
-		var a = $("#a").val().replace(",", ".");
-		var b = $("#b").val().replace(",", ".");
-		var c = $("#c").val().replace(",", ".");
-		
 		var resultverd = verd(a, b, c);
-		$("#result-verd").text(Math.round(resultverd * 100) / 100);
-		
+		document.getElementById('result-verd').innerHTML = Math.round(resultverd * 100) / 100;
+
 		var resultlitrar = eydsla(a, b);
-		$("#result-litrar").text(Math.round(resultlitrar * 100) / 100);
-		
-		$(".eydsla").css("display", "table-row");
-	})
-	
-	$("#a").focus();
-})
+		document.getElementById('result-litrar').innerHTML = Math.round(resultlitrar * 100) / 100;
+	}
+
+	function verd(a, b, c)
+	{
+		return b / 100 * a * c
+	}
+
+	function eydsla(a, b)
+	{
+		return b / 100 * a;
+	}
+}