runeveryday — 2012-09-13T21:03:47-04:00 — #1
<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...
paul_wilkins — 2012-09-14T04:27:26-04:00 — #2
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"
runeveryday — 2012-09-14T05:44:03-04:00 — #3
i am sorry, i don't follow the second part and don't know how to do?thank u
paul_wilkins — 2012-09-14T06:13:24-04:00 — #4
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>
runeveryday — 2012-09-14T06:24:47-04:00 — #5
how you will use the fragment identifier, thank you , the more detail is better,
paul_wilkins — 2012-09-14T06:30:35-04:00 — #6
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.