Jump to content

So i typed the following script:

function toets(){		var goed = 0;	for (x =0; x<10; x++)	{		var input = "<input type = 'number'>"		var getal1 = Math.floor((Math.random()*10) + 1);		var getal2 = Math.floor((Math.random()*10) + 1);		var getal3 = Math.floor((Math.random()*10) + 1);		var getal4 = Math.floor((Math.random()*10) + 1);		var getal5 = Math.floor((Math.random()*10) + 1);		var getal6 = Math.floor((Math.random()*10) + 1);		output += ("<tr><td>" + getal1 + "x" + getal2 + " =" + "</td><td>" + input + "</td><td>" + getal3 + "x" + getal4 + " =" + "</td><td>" + input + "</td><td>" + getal5 + "x" + getal6 + " =" + "</td><td>" + input + "</td></tr>" );		if(input == getal1 * getal2 || getal3 * getal4 || getal5 * getal6)		{			goed++;		}	}	var tabel = "<table>"	var controle = "<button onclick='alert(\"U heeft \" + goed + \"Vragen goed \")'>Lever de toets in</button></table>";	document.getElementById("output").innerHTML =  tabel + output + controle;		return false;}

this code gives 2 errors :

 

to start on the page i see the following text: [object HTMLDivElement]

and 2nd when I click on the button it says goed not defined 

Beneath this mask there is an idea, and ideas are bulletproof.

Link to comment
https://linustechtips.com/topic/292210-javascript-error/
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×