Networking | Hardware | Software | Multimedia | System | Unix&Linux | MBA

Home>>Hardware>>onclick

onclick

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

I've got:

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

and:

<a href=http://www.codingforums.com/archive/index.php/"javascript:void(0)" onclick="appear();"><img src=http://www.codingforums.com/archive/index.php/"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,
imatus

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

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


 

TOP

For more info

setting a minimum size
Auto Preview of Image 
Refresh with a query s
JS Validation obsolete
Javascript Pop up func
Slide show transitions
I'm a newbie...please!
how to write coding in
Advanced Debug Info 
.js file doesn't work 

News Archive

Adding Graphic To Text
re-direct form after s
pop up window controls
Clock on homepage - He
passing a param from a
Password Procection wi
document.title in same
focus onload 
Counting Wrong from Ri
Help needed on how to 

Related stories:

Moz, onkeyup and readOnly problem
Input text filed
Create text boxes on the fly

Copyright@2004-2005 www.zzcoke.com All Right Reserved

advanced web statistics