0
Good morning. I want to create a function to open an external page by clicking. For example, html would look like this:
<div class="pai">
<div class="filho">
<img class="jogo" name="jogo1" onclick="jogar()">
</div>
<div class="filho">
<img class="jogo" name="jogo2" onclick="jogar()">
</div>
</div>
In Javascript, what would my code look like? For example:
function jogar() {
/* if (clicar na imagem do jogo1) {
abrir site x
} else if (clicar na imagem do jogo2) {
abrir site y
}
Or I could put the play() function straight into the parent div, and make a code in the JS to receive the function when clicking on any child element?
As I have just started to study programming, I still have no clear idea how to make the codes.