Solved

Dynamically change content of DIV box with a mouse click?

Posted on 2007-12-03
2
1,519 Views
Last Modified: 2010-08-05
I'm trying to set up a DIV box where the contents change when a hyperlink (or whatever via mouseclick) is clicked.  For example, I'd like to have a DIV box with links above it that will act as tabs for navigating the content within the DIV.  Is this possible with java/CSS?  If so, how do I do it?
0
Comment
Question by:slick_moe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Author Comment

by:slick_moe
ID: 20396828
Here's an exact example of what I'm trying to do: www.pgatour.com

About mid-way down, I'm trying to accomplish the same thing they did with the News/Columns & Blogs/Most Popular tabbed box.  How did they do this??
0
 
LVL 29

Accepted Solution

by:
Göran Andersson earned 500 total points
ID: 20396912
This is a rather elegant method, that I just came up with:
css:
 
.TabHeader { height: 25px; background: #ccc; }
.TabHeader a { float: left; padding: 0 5px; line-height: 25px; }
 
.Tab1 .Tab1Header,
.Tab2 .Tab2Header,
.Tab3 .Tab3Header { background: #eee; }
 
.TabContent { display: none; }
.Tab1 .TabContent1,
.Tab2 .TabContent2,
.Tab3 .TabContent3 { display: block; }
 
html:
 
<div id="Tabs" class="Tab1">
   <div class="TabHeader">
      <a class="Tab1Header" href="#" onclick="document.getElementById('Tabs').className = 'Tab1';">Tab 1</a>
      <a class="Tab2Header" href="#" onclick="document.getElementById('Tabs').className = 'Tab2';">Tab 2</a>
      <a class="Tab3Header" href="#" onclick="document.getElementById('Tabs').className = 'Tab3';">Tab 3</a>
   </div>
   <div class="TabContent TabContent1">
      Content 1
   </div>
   <div class="TabContent TabContent2">
      Content 2
   </div>
   <div class="TabContent TabContent3">
      Content 3
   </div>
</div>

Open in new window

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

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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)
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

749 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