Cpanel web hosting - BC470Part VIBonus Chaptersreturn (b.sales.Q3_2000.quotaPct - a.sales.Q3_2000.quotaPct); } }

BC470Part VIBonus Chaptersreturn (b.sales.Q3_2000.quotaPct - a.sales.Q3_2000.quotaPct); } } function sortDBByQ4Fcst(a, b) { if (document.getElementById( orderChooser ).value == inc ) { return (a.sales.Q4_2000.forecast - b.sales.Q4_2000.forecast); } else { return (b.sales.Q4_2000.forecast - a.sales.Q4_2000.forecast); } } function sortDBByQ4Actual(a, b) { if (document.getElementById( orderChooser ).value == inc ) { return (a.sales.Q4_2000.actual - b.sales.Q4_2000.actual); } else { return (b.sales.Q4_2000.actual - a.sales.Q4_2000.actual); } } function sortDBByQ4Quota(a, b) { if (document.getElementById( orderChooser ).value == inc ) { return (a.sales.Q4_2000.quotaPct - b.sales.Q4_2000.quotaPct); } else { return (b.sales.Q4_2000.quotaPct - a.sales.Q4_2000.quotaPct); } } function sortDBByTotalFcst(a, b) { if (document.getElementById( orderChooser ).value == inc ) { return (a.totalForecast - b.totalForecast); } else { return (b.totalForecast - a.totalForecast); } } function sortDBByTotalActual(a, b) { if (document.getElementById( orderChooser ).value == inc ) { return (a.totalActual - b.totalActual); } else { return (b.totalActual - a.totalActual); } } function sortDBByTotalQuota(a, b) { if (document.getElementById( orderChooser ).value == inc ) { return (a.totalQuotaPct - b.totalQuotaPct); } else { return (b.totalQuotaPct - a.totalQuotaPct); } } For this application, all sorting functions branch in their execution based on the choice made inthe Ordered selectelement on the page. The relative position of the two array elementsunder test in these simple subtraction comparison statements reverses when the sort order isfrom low to high (increasing) and when it is from high to low (decreasing). This kind of arraysorting is extremely powerful in JavaScript and probably escapes the attention of most scripters. Constructing the tableAs recommended back in Chapter 37 s discussion of tableand related elements, it is oftenconvenient to manipulate the structure of a tableelement by way of the specialized methodsfor tables, rather than mess with nodes and elements. The drawTextTable()function isdevoted to employing those methods to create the rendered contents of the table below the

Leave a Reply