I'm trying to make a simple HTML file with a checkbox and a javascript that change the color of the checkbox when clicked. The problem is that the javascript file is not called, so clicking the button is useless as the javascript code is not being read. It seens very simple but I can't see what am I doing wrong:
HTML code:
<!DOCTYPE html>
<html>
<head>
<script src="and_gate.js" defer></script>
</head>
<body style= "background-color: white;">
<label id=in1 class="container1" onclick="in1(element1)">0
<input type="checkbox">
</label>
<style>
.container1 {
background-color:green;
font-size: 2vw;
}
</style>
</body>
</html>
Javascript code:
alert('clicked')
funtion in1(element1){
element1.style="background-color:red;"
}
Aucun commentaire:
Enregistrer un commentaire