và nếu bạn muốn hạn chế phạm vi hoạt động hàng chỉ vào các hàng trong một đoạn. Ví dụ, nếu bảng của bạn có một thead là vẫn còn tĩnh, kịch bản của bạn có thể vui vẻ vòng lặp Khả năng tương thích: WinIE4 +, MacIE5, NN6 +, Moz1 +, Safari1 + | Chapter 52 Application Outline-Style Table of Contents BC399 i collapsedWidgetEnd blockID 0 collapsedWidgetStart collapsedWidget output height widgetHeight width widgetWidth output title Click to expand collapse nested items. onclick toggle this blockID link i .getAttribute uri i .getAttribute uri if link output nbsp a href link class itemTitle title link target displayTarget else output nbsp a class itemTitle title link output nbsp i .getAttribute text a currState calcBlockState outlineID currID-1 output span class OLBlock blocknum blockID id OLBlock blockID nestPrefix prefix nestPrefix i - 1 img src emptySpace height 16 width 20 img src chainSpace height 16 width 20 output makeHTML outlineID i nestPrefix output span div n else output prefix output img id widget currID-1 src i - 1 nodeWidgetEnd nodeWidget output height widgetHeight width widgetWidth link i .getAttribute uri i .getAttribute uri if link output nbsp a href link class itemTitle title link target displayTarget else output nbsp a class itemTitle title link output i .getAttribute text a output div n return output As with the HTML assembly code of the first outliner if you were to add attributes to outline elements in an OPML outline for example a URL for an icon to display in front of the text it is in makeHTML that the values would be read and applied to the HTML being created. The only other function invoked by the makeHTML function is calcBlockState . This function looks into one of the OPML outline s head elements called expansionstate. This element s values can be set to a comma-delimited list of numbers corresponding to nodes that are to be shown expanded when the outline is first displayed. The calcBlockState function is invoked for each parent element. The element s location is compared against values in the expansionstate element if .