Tom Sampson

General and Tech Stuff! – Please Please leave comments! I will ALWAYS read and reply.

Show/Hide page element in one function March 25, 2006

Filed under: Javascript — tomtech999 @ 10:19 pm

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’;
}
}

 

Leave a Reply