Saturday, March 25, 2006

Show/Hide page element in one function

I wrote the function below in javascript, it has 0 arguments. This function checks and sets the element "emotions" (an emotions panel in a blog i am making). This wil make the emotions div tag visible/hidden alternating each time the function is run.

function hideemo()
{
if(document.getElementById('emotions').style.display == 'none')
{
document.getElementById('emotions').style.display = 'block'
}
else
{
document.getElementById('emotions').style.display = 'none';
}
}

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home