JavaScript Function to Expand All Sections in Document on the Web

Author: Tripp W Black

Created: 03/20/2001 at 03:49 PM


Notes Developer Tips
Forms/Subforms, JavaScript


The formula @Command([SectionExpandAll]) allows Notes users to expand all sections in a document. This formula is not supported for web clients. How can this same functionality be achieved for web clients?


To create this functionality on the web, create a JavaScript function in the JSHeader event of the form with the following code:

function expandAll() {
var secList="";

// Loop through all Anchors with _Section in
for (var i=0; i<document.anchors.length; i++) {
var a=document.anchors[i].name;

if (a.indexOf('_Section') != -1) {
// Found a section. Store its # in secNum

if (secList=="") {
// this is the first Section found begin the list of sections
} // end if

else {
// append additional Section numbers to list of sections
} // end if...else

} // end if a.indexOf
} // end for loop

// Check for 'stop' in QueryString to prevent infinite loop (this is for onLoad execution)
if ('Stop') == -1) {

} //end function

Then call the function "expandAll()" from the Form's onLoad event, a Form Action or Action Hotspot.


Supporting Information:

This script does not work for nested sections. When nested sections are collapsed, not all of the section anchors display.

Related Documents:

Can All Sections in a Document be Expanded or Collapsed at Once Through a URL?
Document #: 165840

(C) Copyright 2001 Lotus Development Corporation. All rights reserved.

previous page