Solved

Hide a Table when I click over image

Posted on 2002-05-20
6
144 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
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article discusses four methods for overlaying images in a container on a web page
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

860 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