Reputation: 41
hi i am try to reveal the content in my div para2 when the user clicks the more img link
i have used this code before and it worked but i wont now ??
Please point out my mistakes i am only a beginner
thanks in advance
<blockquote>
<p>
<a href="#para2"/>
<a href="#" onclick="return toggleMe('para2')" onfocus="#para2"/> <img src="images/more.gif" alt="" title="" border="0"></a>
<div id="para2" style="display:none">
text i want to reveal
</div>
</p>
</blockquote>
sorry
<script type="text/javascript">
function toggleMe(a){
var e=document.getElementById(a);
if(!e)return true;
if(e.style.display=="none"){
e.style.display="block"
}
else{
e.style.display="none"
}
return true;
}
</script>
</head>
Upvotes: 2
Views: 378
Reputation: 324610
#para2
is not a valid piece of javascript code, so you can't use it as an onfocus
attribute.
Since you're getting a syntax error there, it is possible that it's breaking out of the onclick
code as well, therefore not running it.
Try removing the onfocus
attribute, and see if that fixes it.
Upvotes: 1