Wrox Programmer Forums
|
BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0
This is the forum to discuss the Wrox book Professional JavaScript for Web Developers by Nicholas C. Zakas; ISBN: 9780764579080
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 6th, 2005, 02:15 PM
Registered User
 
Join Date: Dec 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to peryan77
Default 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.







Similar Threads
Thread Thread Starter Forum Replies Last Post
Convering a String Array to an Integer array nkrust C# 9 November 17th, 2010 12:02 PM
Go from 2d Array to 1d array without defining type OneQuestion General .NET 1 January 10th, 2008 11:13 AM
error when sorting an Array of Array nancy VBScript 2 February 17th, 2005 12:57 PM
Passing php array values to javascript array gkrishna Pro PHP 0 November 6th, 2004 03:20 AM
Array to Array comparison pavel Pro VB 6 0 March 24th, 2004 06:33 PM





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