Я пытаюсь создать DIV с размером 100x100 пикселей, и он должен быть красным, каждый раз, когда нажимается кнопка, я делал этот код, но он не работает:
<html>
<title>
create new div
</title>
<body>
<button id="createsquare">
Cria QUADRADO
</button>
<script>
function fcreatesquare()
{
var crsq = document.createElement('div', 'id=created', 'widght=100px', 'wheidght=100px','color=black');
return crsq;
}
var createsquare = document.getElementById('createsquare');
createsquare.onclick(fcreatesquare);
</script>
</body>
</html>