Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Hide a Table when I click over image

Posted on 2002-05-20
6
Medium Priority
?
148 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 200 total points
ID: 7023298
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
ID: 7023544
nice code
0
 
LVL 23

Expert Comment

by:b1xml2
ID: 7023557
thank you =)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:jpoesen
ID: 7023573
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
ID: 7023837
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
ID: 7023860
cd&
you old codger you =))
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

885 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