Click to return to the HTML Help home page    
Web Workshop  |  DHTML, HTML & CSS  |  HTML Help

To Insert the JavaScript Code


Microsoft Corporation

Updated June 10, 1999

Insert the following JavaScript functions between the <HEAD> start and end tags of the page:

<SCRIPT LANGUAGE="JavaScript">
<!--
function function1Name(idVariable){
//display the section if it's not displayed; hide it if it is displayed
if (idVariable.style.display=="none"){idVariable.style.display=""}
else{idVariable.style.display="none"}
}
function function2Name(idVariable){
//remove the section when user clicks in the opened DIV
if (idVariable.style.display==""){idVariable.style.display="none"}
}
-->

Where function1Name and function2Name are the names of each function, and idVariable is the variable for the unique ID that is passed to the script each time a user clicks the link.

Example

The following is the actual JavaScript code used in the HTML Help documentation:

function doSection (secNum){
//display the section if it's not displayed; hide it if it is displayed
if (secNum.style.display=="none"){secNum.style.display=""}
else{secNum.style.display="none"}
}

function noSection (secNum){
//remove the section when user clicks in the opened DIV
if (secNum.style.display==""){secNum.style.display="none"}
}

Notes


next step Update your style sheet
 


Back to topBack to top

Did you find this material useful? Gripes? Compliments? Suggestions for other articles? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.