p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 (http://p2p.wrox.com/forumdisplay.php?f=174)
-   -   Array Help - Thus far no one was able to help. (http://p2p.wrox.com/showthread.php?t=35852)

peryan77 December 6th, 2005 02:15 PM

Array Help - Thus far no one was able to help.
 
I need some help with taking the array "pcor_sections" and exactly creating the "TREE_NODES" array. I am new to JS and you seriously don't want me to paste what I have so far. It's confusing.
Some rules are posted at the bottom to make it easier to understand.


var pcor_sections = [ 0

,'<p class="chap"><a href="chf-ES.htm#P6_36" target="_top">Executive Summary</a></p>'

,'<p class="ahead"><a href="chf-ES-cmc-00.htm#P52_1438" target="_top">What are the key parameters of the CHF market?</a></p>'

,'<p class="chap"><a href="Pharmacor-Chapter-Head.htm#P89_11313" target="_top">Introduction</a></p>'

,'<p class="chap"><a href="CHF-EP-cmc.htm#P210_16143" target="_top">Etiology and Pathophysiology </a></p>'

,'<p class="ahead"><a href="CHF-EP-cmc-02.htm#P242_29404" target="_top">Etiology</a></p>'

,'<p class="bhead"><a href="CHF-EP-cmc-02.htm#P13_3767" target="_top">Causes of Chronic Heart Failure</a></p>'

,'<p class="bhead"><a href="CHF-EP-cmc-02.htm#P18_5924" target="_top">Clinical Characterization of Chronic Heart Failure</a></p>'

,'<p class="ahead"><a href="epi-mock-up-cmc-03.htm#P62_16890" target="_top">United States</a></p>'

,'<p class="chap"><a href="chf-ct.htm" target="_top">Current Therapies</a></p>'

,'<p class="ahead"><a href="chf-ct-cmc-00.htm" target="_top">Diuretics</a></p>'

];


var TREE_NODES = [

    f(["Executive Summary", "chf-ES.htm", null,
        f(["What are the key parameters of the CHF market?", "chf-ES-cmc-00.htm", null]),
    ]),


    f(["Introduction", "Pharmacor-Chapter-Head.htm", null,{format:{isFolder:true}}]),


    f(["Etiology & Pathophysiology", "CHF-EP-cmc.htm", null,
        f(["Etiology", "CHF-EP-cmc-02.htm", null,
            f(["Causes of Chronic Heart Failure", "CHF-EP-cmc-02.htm#P13_3767", null]),
            f(["Clinical Characterization of Chronic Heart Failure", "CHF-EP-cmc-02.htm#P18_5924", null])
        ]),
        f(["United States", "epi-mock-up-cmc-03.htm#P62_16890", null]),
    ]),


    f(["Current Therapies", "chf-ct.htm", null,
        f(["Diuretics", "chf-ct-cmc-00.htm", null]),
    ]),

        ];


Rules
remove #p242_2393 framgments where the classes = chap or ahead.
if a chap has no ahead or bhead following it then we need to add {format:{isFolder:true}} (see introduction)
Also, notice the brakets ] and when they should or shouldn't close. Like if Ahead has B head you keep the Ahead open and close after bhead.




All times are GMT -4. The time now is 08:07 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.