View Full Version : onclick

10-12-2005, 12:03 PM
Hello again everybody :)

I've got:

function appear()
document.getElementById('content').innerHTML = ("test");


<a href="javascript:void(0)" onclick="appear();"><img src="images/note.gif" name="note" alt="Note" border="0" width="191" height="21"></a>

followed by:

<span id="content"></span>

It does work and then I press the image-link the content appears below the link.

However, I wonder if it is possible to make the content disappear when I click on the same image-link for the second time? i.e. I click once - the content appears, I click second time - the content disappears?

If you have an idea on how it could be done, please drop me a hint,
Thank you in advance,

10-12-2005, 12:12 PM
function appear()
var obj = document.getElementById('content');
obj.innerHTML = (obj.innerHTML=='')?'test':'';

10-12-2005, 12:21 PM
Thank you very much, Kor :thumbsup:

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum