[Javascript] Show and hide multiple div tags

Andrew Gibson andrew at shuttle.net.nz
Tue May 9 03:57:06 CDT 2006


something like this:

where exID is the id of your "ExtendedDescription"

function showHide(exID)
{
  var show=document.getElementById(exID)

 if(show.style.display=="none")
    show.style.display="";
  else
   show.style.display="none"

}



==========================================
Perhaps - would it be best to put in an ID for each news item?

eg


<div class="News">
    <div id="NewsItem">
        <h2>News title 1</h2>
        <div class="BriefDescription"></div>
        <div class="ShowExtendedDescription"><a href="#" 
onclick="jsfncShowHideExtendedDescription('NI1234')">Show Extended 
Description for this event</a></div>
        <div id="NI1234" class="ExtendedDescription"></div>
    </div>

if so how would I pass the news item to the function? like i have in this 
example? as a string?

and how would i tell the browser to change the class for that particular 
div?

Thanks

Regards
Abyss



_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript 




More information about the Javascript mailing list