Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-04-2011, 01:33 PM   PM User | #1
chris24300
New Coder

 
Join Date: Dec 2009
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
chris24300 is an unknown quantity at this point
Question Custom Logo and click handlers

Hi All,

I'd like to create a custom logo (don't know what yet) that represents the pieces of my project so that a user can click on a piece of the logo and have that associated panel brought forth. I'm not sure how to go about doing this so could someone point me in the right direction?

Thanks!
chris24300 is offline   Reply With Quote
Old 10-04-2011, 04:36 PM   PM User | #2
xelawho
Senior Coder

 
xelawho's Avatar
 
Join Date: Nov 2010
Posts: 2,437
Thanks: 52
Thanked 454 Times in 452 Posts
xelawho will become famous soon enoughxelawho will become famous soon enough
img (graphic) elements can have an onclick attribute, which can be used to fire a function and that would in turn show and hide divs or other images or whatever your panels are. It's very simple and doesn't require alot of the convoluted code that you will find googling on the subject. here's some quasi code that might actually work:

Code:
<style>
.hide{
display:none;
}
</style>
<img src="logo1.jpg" onclick="showstuff('div1')">
<img src="logo2.jpg"  onclick="showstuff('div2')">

<div class="hide" id="div1">Div one is here</div>
<div class="hide" id="div2">Div two is here</div>


<script type="text/javascript">
var shownDiv;
function showstuff(divID){
if (shownDiv){
document.getElementById(shownDiv).style.display="none";
 }  
    document.getElementById(divID).style.display="block";
	shownDiv=divID;
}

</script>
xelawho is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:37 AM.


Advertisement
Log in to turn off these ads.