
Hide or Show javascript part 2 : getElementById
Posted under » JavaScript on 11 November 2009
I hope you have read the version one of hide and show or version 3.
This is the more practical usage especially if you have more than one things to hide and show. The neat thing is that you can toggle between hide and show using the same button.
Put this on your header.
Then put your text on the body of the HTML like so. Don't forget to put the id.
Dr. Jeremy
more »
Dr. Jeremy P. Blaydes has a BSc. in Biochemistry from the University of Bath and a PhD in tumour biology from the University of Wales.
Professor Ted Hupp
more »
Professor Ted Hupp obtained a PhD at Michigan State University in USA under the inspiring guidance of Jon Kaguni working out enzymological mechanisms of initiation of DNA replication where the first demonstration of mutant protein reactivation was described by the heat shock protein system. Working as a post-doctoral scientist with the even more inspiring David Lane, the concept of p53 activation was developed using emerging tools in the peptide therapeutics field.
You can also show and hide using a checkbox instead of a link with the "onchange" or "onclick" tag.
<input name="market" type="checkbox" value="Yes" onchange="javascript:toggle2('speaker2','more2');" />