1
My goal is to make a program that has a list, and each time the mouse goes over the name of that list, it shows a content of a div
, but then using this code here, I created an array for each item on the list, but I can’t get it to show. Someone may show error or solution?
<blink>
<html>
<body>
<script type="text/javascript">
function mostra()
{
var arraypilotes=["1","2","3"];
document.getElementById('arraypilotes[i]').style.display = 'block';
}
function esconde()
{
var arraypilotes=["1","2","3"];
document.getElementById('arraypilotes[i]').style.display = 'none';
}
</script>
<a href="#" onmouseover="javascript:mostra();" onmouseout="esconde();">Teste</a>
<div id="arraypilotes[0]" style="display:none;">Conteudo da DIV</div>
<br/>
<br/>
<a href="#" onmouseover="javascript:mostra();" onmouseout="esconde();">Teste2</a>
<div id="arraypilotes[1]" style="display:none;">Conteudo da DIV</div>
<br/>
<br/>
<a href="#" onmouseover="javascript:mostra();" onmouseout="esconde();">Teste3</a>
<div id="arraypilotes[2]" style="display:none;">Conteudo da DIV</div>
</body>
</html>
</blink>
onmouseover="javascript:mostra();"
must beonmouseover="mostra();"
, the prefixjavascript:
should be used to run javascript on links<a>
– Pedro Sanção