That is caused by your use of the href="#" which means, goto to the anchor name on this page with no name, or essentially, goto top. That was never suggested as a method when using this script. Here, from the demo page, are the suggested methods:
HTML Code:
<!--Optional Expand/ Contact All links. Remove if desired-->
<div><a href="javascript:sweeptoggle('contract')">Contract All</a> | <a href="javascript:sweeptoggle('expand')">Expand All</a></div>
<h3 onClick="expandcontent(this, 'sc1')" style="cursor:hand; cursor:pointer"><span class="showstate"></span>What is JavaScript?</h3>
<div id="sc1" class="switchcontent">
JavaScript is a scripting language originally developed by Netscape to add interactivity and power to web documents. It is purely client side, and runs completely on the client's browser and computer.
</div>
<h3 onClick="expandcontent(this, 'sc2')" style="cursor:hand; cursor:pointer"><span class="showstate"></span>Difference between Java & JavaScript?</h3>
<div id="sc2" class="switchcontent">
Java is completely different from JavaScript- the former is a compiled language while the later is a scripting language.
</div>
<h3 onClick="expandcontent(this, 'sc3')" style="cursor:hand; cursor:pointer"><span class="showstate"></span>What is DHTML?</h3>
<div id="sc3" class="switchcontent">
DHTML is the embodiment of a combination of technologies- JavaScript, CSS, and HTML. Through them a new level of interactivity is possible for the end user experience.
</div>
If you want to use an anchor (<a ....>something</a>) you can use it without any href= attribute, though that is unusual and may cause problems with some browsers. Substituting <span> tags should be fine. So for:

Originally Posted by
Cale (from Cale's source code)
HTML Code:
<a href="#" onClick="expandcontent(this, 'sc1')"style="cursor:hand; cursor:pointer"><span class="showstate"></span></a>
you could try:
HTML Code:
<span onClick="expandcontent(this, 'sc1')" style="cursor:hand; cursor:pointer"><span class="showstate"></span></span>
Also, notice that you have left out a space between:
onClick="expandcontent(this, 'sc1')" and style="cursor:hand; cursor:pointer"
Bookmarks