Solved

Hide a Table when I click over image

Posted on 2002-05-20
6
141 Views
Last Modified: 2010-04-09
How to hide a Table when i click over an image and then make the table visible when i click on the image next time.

thanks
0
Comment
Question by:elzohry
  • 3
  • 2
6 Comments
 
LVL 23

Accepted Solution

by:
b1xml2 earned 50 total points
Comment Utility
to hide the table, use the css property.
applicable to MSIE4+,NS6+
<html>
<head>
<script>
function toggleElement(szId) {
 var el = document.getElementById ? document.getElementById(szId) : document.all ? document.all[szId] : null;
 if (! el) return;
 //try experimenting with block or inline
 el.style.display = el.style.display == "none" ? "block" : "none";
}
</script>
</head>
<body>
<img src="logo.gif" onclick="toggleElement('data');">
<table id="data" style="display:none;">
<tr>
 <td>Hello</td>
</tr>
</table>
</body>
</html>
0
 
LVL 2

Expert Comment

by:jpoesen
Comment Utility
nice code
0
 
LVL 23

Expert Comment

by:b1xml2
Comment Utility
thank you =)
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 2

Expert Comment

by:jpoesen
Comment Utility
finally a perfect example of how to use trinary operators. EE really IS a great place to learn :)
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
Comment Utility
Well very pretty, if you don't need to support level 4 browsers and if it only has one image and one table and the user is actually able to understand the code well enough to maintain it.  

Of cross-browser means you actually have to do a little more work in both the script and the HTML.  Of course I'm an old dinosaur, so maybe slick is better, flexible.

elzohry,

If you need to support level 4 browsers, let us know.  I'm sure b1 will be happy to give you a complete solution.

Cd&

0
 
LVL 23

Expert Comment

by:b1xml2
Comment Utility
cd&
you old codger you =))
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now