I have a table of contents and an index which link to some
other documents with anchors. Some of the other docs start
off hiding the content of their topics (an appendix with a lot
of assembly language mnemonics).
I'm looking for a way to open a specific topic up and display
the contents of that topic.
http://www.microcosmotalk.com/tech/asm/nasm/help/
Some of the links there are javascript links for a compiled
help metafile and do not work for certain browsers. So I'm
also looking for the best way to handle that problem, so as
to display the appropriate link based upon if it's compiled in
a .chm or if it's getting read via the Internet. There's nothing
server-side going on inside those files, so javascript ends up
as the elected client-side scripting language.
Take a look at the Appendix B section and open that section
up. Currently the links to the assembly language instructions
do not open the appropriate section. I created an open all
"doShowAll(9)" in that file to open all 9 sections all at once.
The javascript file is small. Any suggestions are welcome.
Thank you very much for your help and attention.

Signature
Jim Carlock
Jim Carlock - 30 Jun 2007 23:51 GMT
Here's the source code for the first section in the table of contents.
Watch the word wrap.
(1) I'm thinking about setting the links up into a javascript function to
reduce the size of the file.
<hr id="Chap01" />
<h2><a onclick="doShow(1);" href="#nowhere"><img src="images/arrowrt.gif" style="width:11px;height:11px;" id="oAr1" alt="Click to
open list." />Chapter 1<br />Introducing NASM</a></h2>
<div class="sublinks">Chapter 1 | <a href="#Chap02" title="Running NASM">Chapter 2</a> | <a href="#Chap03" title="NASM Assembly
Language Basics">Chapter 3</a> | <a href="#Chap04" title="NASM Preprocessor">Chapter 4</a> | <a href="#Chap05" title="NASM Assembler
Directives">Chapter 5</a><br />
<a href="#Chap06" title="NASM Output Formats">Chapter 6</a> | <a href="#Chap07" title="16 Bit Encoding">Chapter 7</a> | <a
href="#Chap08" title="32 Bit Encoding">Chapter 8</a> | <a href="#Chap09" title="Mixing 16 Bit And 32 Bit Code">Chapter 9</a> | <a
href="#Chap10" title="Troubleshooting NASM">Chapter 10</a><br />
<a href="#AppendixA" title="NDISASM">Appendix A</a> | <a href="#AppendixB" title="x86 Instruction Set Reference">Appendix
B</a></div>
<div id="oPara1" style="display:none;">
<hr />
<p><a href="nasmdo01.htm">Introduction</a><br />
<a href="nasmdo01.htm#section-1.1">Section 1.1: What Is NASM?</a><br />
<a href="nasmdo01.htm#section-1.1.1">Section 1.1.1: Why Yet Another Assembler?</a><br />
<a href="nasmdo01.htm#section-1.1.2">Section 1.1.2: License Conditions</a><br />
<a href="nasmdo01.htm#section-1.2">Section 1.2: Contact Information</a><br />
<a href="nasmdo01.htm#section-1.3">Section 1.3: Installation</a><br />
<a href="nasmdo01.htm#section-1.3.1">Section 1.3.1: Installing NASM under MS-DOS or Windows</a><br />
<a href="nasmdo01.htm#section-1.3.2">Section 1.3.2: Installing NASM under Unix</a></p></div>
The javascript function used to view the "oPara1":
<h2><a onclick="doShow(1);" href="#nowhere">
from the NASM.js file...
/*
* doShow(iNum) used inside NASM_TOC.htm
*/
function doShow(iNum) {
var oPara = document.getElementById("oPara" + iNum);
var oImg = document.getElementById("oAr" + iNum);
// expand paragraph and rotate the arrow; collapse and rotate it back
// alert("oPara.style.display = " + oPara.style.display + " " + oImg.style.display);
if (oPara.style.display == "none") { oPara.style.display=""; oImg.src="images/arrowdn.gif"; }
else { oPara.style.display = "none"; oImg.src = "images/arrowrt.gif"; }
}
To do this right, I believe I need to check to see if
document.getElementById
works. So, while the following code is not in place yet, and going by
what I'm finding at:
http://www.jibbering.com/faq/faq_notes/alt_dynwrite.html#getEl
does the following look proper?
/*
* doShow(iNum) used inside NASM_TOC.htm
*/
function doShow(iNum) {
var oPara = null;
var oImg = null;
if (document.getElementById) {
oPara = document.getElementById("oPara" + iNum);
oImg = document.getElementById("oAr" + iNum);
} else if (document.all) {
/* Branch to use document.all on document.all only
browsers. Requires that IDs are unique to the page
and do not coincide with NAME attributes on other
elements:-
*/
oPara = document.all["oPara" + iNum];
oImg = document.all["oImg" + iNum];
} else {
return;
}
// expand paragraph and rotate the arrow; collapse and rotate it back
// alert("oPara.style.display = " + oPara.style.display + " " + oImg.style.display);
if (oPara.style.display == "none") { oPara.style.display=""; oImg.src="images/arrowdn.gif"; }
else { oPara.style.display = "none"; oImg.src = "images/arrowrt.gif"; }
}
And IF I do not encode in such a manner, does anyone have a list
of which browsers support what and who I'll miss out on? I get
a funny feeling that I will not miss out on too much IF I only leave it
only employing the document.getElementById, because...
The targeted audience will use Firefox or Mozilla or Internet Explorer
(IE 6 or later) or it ends up compiled into an compiled help metafile
(chm) run on Windows 9x or later.
Thanks for suggestions and help. The end results get licensed under
the Free Documentation Licensing as listed at gnu.org.

Signature
Jim Carlock
NASM Help Files
http://www.microcosmotalk.com/tech/asm/nasm/help/