Archive for December, 2007

1 on 1 web hosting - 1316 Part V . Putting JavaScript to Work

Monday, December 31st, 2007

1316 Part V . Putting JavaScript to Work totals column, so they will call addTotals() function directly rather than this function (the rows don t need recalculation). Number formatting, as explained in Chapter 35, is a detail that scripters must handle themselves (unless you are designing for IE5.5+ and NN6+, which include the number.toFixed() method for number formatting). We can borrow the formatting code from Chapter 35, and use it here as-is: function formatNum(expr,decplaces) { var str = (Math.round(parseFloat(expr) * Math.pow(10,decplaces))).toString() while (str.length <= decplaces) { str = 0 + str } var decpoint = str.length - decplaces return str.substring(0,decpoint) + . + str.substring(decpoint,str.length) } Being able to pick up this function from a different application should reinforce the advantage to writing functions to be as generalizable as possible. Rather than building page-specific references into the formatting function, it accepts parameters that could come from anywhere. Page specifics are left to another function that deals with reading and writing text box values. Cooking up some HTML As we near the end of the scripting part of the document s Head section, we come to two functions that are invoked later to assemble some table-oriented HTML based on the global settings made at the top. One function assembles the row of the table that contains the column headings: function makeTitleRow() { var titleRow = for (var i = 0; i < columnHeads.length; i++) { titleRow += + columnHeads[i] + } titleRow += return titleRow } The heart of the makeTitleRow() function is the for loop, which makes simple tags out of the text entries in the columnHeadsarray defined earlier. All this function does is assemble the HTML. A document.write() method in the Body puts this HTML into the document. function makeOneRow(rowNum) { var oneRow = for (var i = 0; i < columnHeads.length; i++) { oneRow += } oneRow += return oneRow }
If you are searching for cheap webhost for your web application, please visit MySQL5 Web Hosting services.

1315Chapter 51 .Application: A Poor Man s (Most popular web site) Order Form

Sunday, December 30th, 2007

1314 Part V . Putting JavaScript (Yahoo web space) to Work

Sunday, December 30th, 2007

1313Chapter 51 .Application: A Poor Man s Order Form (Web server info)

Sunday, December 30th, 2007

1312 Part V . Putting JavaScript (Managed web hosting) to Work

Saturday, December 29th, 2007

Web server - Application: A Poor Man s Order Form Ihesitate to

Saturday, December 29th, 2007

Web site template - 1309Chapter 50 .Application: A Lookup Table // initialize

Friday, December 28th, 2007

1308 Part V . Putting JavaScript to (Web hosting services) Work

Friday, December 28th, 2007

1307Chapter 50 .Application: A Lookup Table (Web hosting bandwidth) Next comes

Thursday, December 27th, 2007

Java web server - 1306 Part V . Putting JavaScript to Work

Thursday, December 27th, 2007