Solved

Hide a Table when I click over image

Posted on 2002-05-20
6
142 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
spacing 5 56
SVG Star 4 34
uploading image to a profile page 1 29
Tableau and Javascript: How to export an array to excel with formatting 11 58
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

914 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

20 Experts available now in Live!

Get 1:1 Help Now