<li onclick="clicker()" class="li01">one</li>
<li onclick="clicker()" class="li02">two</li>
<li onclick="clicker()" class="li03">three</li>
<div style="display:block" >content one</div>
<div style="display:none">content two</div>
<div style="display:none">content three</div>
i want to when click one then show content one.all the content are hidden. two then show content two...
The standard technique for that is for the script to first hide all of the content, and to then show the one that the clicked link refers to.
Typically the second part is achieved by having a link that goes to a fragment identifier, such as "#content1" and to have a div with the same value as its identifier: id="content1"
i am sorry, i don't follow the second part and don't know how to do?thank u
It's where you have a link, and you have some content. The link uses a fragment identifier, which targets the identifier of the content.
<a href="#content1">Link to content 1</a>
<div id="content1">Content 1 is in here</div>
how you will use the fragment identifier, thank you , the more detail is better,
The fragment identifier is the hash symbol followed by some text. For example: #content1
More detail can be found at http://en.wikipedia.org/wiki/Fragment_identifier
But basically, it's how you tell the web browser that you want to scroll the page down to the part of the page that has that identifier.
How it can be used with scripting, it to disable the default web browser behaviour, and to instead use the fragment identifier from the link as a way to identify the area of interest, in this case that would be showing the related content area, after first hiding them all.
This topic is now closed. New replies are no longer allowed.