Archive for the 'MySQL5' Category

1352 Part V . Putting JavaScript to Work (Web design course)

Thursday, January 17th, 2008

1352 Part V . Putting JavaScript to Work swapState(). Then, based on the new setting, the display property of the block is set accordingly, and widget art is changed through two special-purpose functions. // toggle an outline mother entry, storing new state value; // invoked by onClick event handlers of widget image elements function toggle(img, blockNum) { var newString = var expanded, n // modify state string based on parameters passed IMG expanded = currState.charAt(blockNum) currState = swapState(currState, expanded, blockNum) // dynamically change display style if (expanded == 0 ) { document.getElementById( OLBlock + blockNum).style.display = block img.src = getExpandedWidgetState(img.src) } else { document.getElementById( OLBlock + blockNum).style.display = none img.src = getCollapsedWidgetState(img.src) } }
We would like to recommend you tested and proved virtual web hosting services, which you will surely find to be of great quality.

Web hosting e commerce - 1351Chapter 52 .Application: Outline-Style Table of Contents //

Thursday, January 17th, 2008

1351Chapter 52 .Application: Outline-Style Table of Contents // apply default expansion state from outline s header // info to the expanded state for one element to help // initialize currState variable function calcBlockState(outlineID, n) { var ol = document.getElementById(outlineID).getElementsByTagName( body )[0] var outlineLen = ol.getElementsByTagName( outline ).length // get OPML expansionState data var expandElem = document.getElementById(outlineID).getElementsByTagName( expansionState )[0] var expandedData = (expandElem.childNodes.length) ? expandElem.firstChild.nodeValue.split( , ) : null if (expandedData) { for (var j = 0; j < expandedData.length; j++) { if (n == expandedData[j] - 1) { return 1 } } } return 0 } The final act of the initialization process is a call to the initExpand() function. This function loops through the currStateglobal variable (whose value was written in makeHTML() with the help of calcBlockState()) and sets the display property to blockfor any element designed to be expanded at the outset. HTML element construction in makeHTML() is performed in such a way that each parent DIV has a SPAN nested directly inside of it; and inside that SPAN are all the child nodes. The displayproperty of the SPAN determines whether all of those children are seen or not. // expand items set in expansionState XML tag, if any function initExpand(outlineID) { for (var i = 0; i < currState.length; i++) { if (currState.charAt(i) == 1) { document.getElementById( OLBlock + i).style.display = block } } } By the time the initExpand() function has run a lot of setup code that executes pretty quickly the rendered outline is in a steady state. Users can now expand or collapse portions by clicking the widget icons. Toggling node expansion All of the widget images in the outline have onClick event handlers assigned to them. The handlers invoke the toggle()function, passing parameters consisting of a reference to the IMG element object receiving the event and the serial number of the SPAN block nested just inside the DIV that holds the image. With these two pieces of information, the toggle() function sets in motion the act of inverting the expanded/collapsed state of the element and the plus or minus version of the icon image. The blockNumparameter corresponds to the position within the currState string of 1s and 0s holding the flag for the expanded state of the block. With the current value retrieved from currState, the value is inverted through
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.

1350 Part V . Putting JavaScript to Work (Web hosting solutions)

Thursday, January 17th, 2008

1350 Part V . Putting JavaScript to Work output +=   + ol.childNodes[i].getAttribute( text ) + currState += calcBlockState(outlineID, currID-1) output += // accumulate prefix art for next indented level nestPrefix = prefix nestPrefix += (i == ol.childNodes.length - 1) ? : // reflexive call to makeHTML() for nested elements output += makeHTML(outlineID, ol.childNodes[i], nestPrefix) output +=

n } else { // for endpoint nodes output += prefix output += // check for links for these entries link = (ol.childNodes[i].getAttribute( uri )) ? ol.childNodes[i].getAttribute( uri ) : if (link) { output +=   } else { output +=   } // grab the text for these entries output += ol.childNodes[i].getAttribute( text ) + output +=
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 there are any, and returns the appropriate 1 or 0value for the state string being assembled for the rendered outline.
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.

Web hosting servers - 1349Chapter 52 .Application: Outline-Style Table of Contents One

Wednesday, January 16th, 2008

1349Chapter 52 .Application: Outline-Style Table of Contents One of the fine points of the design of this outline is the way space to the left of each entry is assembled. Unlike the earlier outlines in this chapter, this one displays vertical dotted lines connecting nodes at the same level. There isn t a vertical line for every clickable node appearing above the item, because a clickable node may have no additional siblings, meaning that the space is blank. To see what I mean, open the OPML example, and expand the Peas and Canned nodes (or see Figure 52-2). The Canned node is the end of the second column, so the space beneath the icon is blank. That s what some of the code in makeHTML()named prefix is dealing with: Accumulating just the right combination of dotted line (chain.gif) and blank (empty.gif) images in sequence before the outline entry. Another frequent construction throughout this function is a three-level conditional expression. This construction is used to determine whether the image just to the left of the item s text should be a start, middle, or end version of the image. The differences among them are subtle (having to do with how the vertical dotted line extends above or below the widgets). All of these decisions are made from information revealed by the inherent structure of the OPML element nesting. The listing in the book looks longer than it truly is because so many long or deeply nested lines must be wrapped to the next line. Viewing the actual file in your text editor should calm your fears a bit. // counters for reflexive calls to makeHTML() var currID = 0 var blockID = 0 // generate HTML for outline function makeHTML(outlineID, ol, prefix) { var output = var nestCount, link, nestPrefix prefix = (prefix) ? prefix : for (var i = 0; i < ol.childNodes.length ; i++) { nestCount = ol.childNodes[i].childNodes.length output +=

n if (nestCount > 0) { // for entries that are also parents output += prefix output += // if a uri is specified, wrap the text inside a link link = (ol.childNodes[i].getAttribute( uri )) ? ol.childNodes[i].getAttribute( uri ) : if (link) { output +=   } else { output +=   } // finally! the actual text of the entry
If you are searching for cheap webhost for your web application, please visit
MySQL5 Web Hosting services.

1348 Part V . Putting JavaScript to Work (Web server info)

Wednesday, January 16th, 2008

1348 Part V . Putting JavaScript to Work the entire outline HTML to be assigned to the innerHTML property of the empty DIV element delivered with the document. // initialize first time function init(outlineID) { if (supportVerified(outlineID)) { // demo how to get outline head elements var hdr = document.getElementById(outlineID).getElementsByTagName( head )[0] // get outline body elements for iterative conversion to HTML var ol = document.getElementById(outlineID).getElementsByTagName( body )[0] // wrap whole outline HTML in a span var olHTML = + makeHTML(outlineID, ol) + // throw HTML into content DIV for display document.getElementById( content ).innerHTML = olHTML initExpand(outlineID) } } Validation of browser support is handled by the supportVerified() function. This function is in search of the XMLDocumentproperty of the XML element object. The property s presence indicates that the browser has what it takes to treat embedded XML as a data island. Incremental tests are needed so that earlier browsers don t choke on the reference to the property. // verify that browser supports XML islands function supportVerified(testID) { if (document.getElementById && document.getElementById(testID) && document.getElementById(testID).XMLDocument) { return true } else { var reply = confirm( This example requires a browser with XML data island support, such as IE5+/Windows. Go back to previous page? ) if (reply) { history.back() } else { return false } } return false } Accumulating the HTML From the init()function, a call to the makeHTML() function starts the most complex actions of the scripts on this page. This function walks the node hierarchy of the outline s BODY elements, deciphering which ones are containers and which ones are end points. Two global variables are used to keep track of how far the node walk progresses because this function calls itself from time to time to handle nested branches of the node tree. Because a reflexive call to a function starts out with new values for local variables, the globals operate as pointers to let statements in the function know which node is being accessed. The numbers get applied to an ID attribute assigned to the DIV elements holding the content.
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.

1347Chapter 52 .Application: Outline-Style Table of Contents Also, (My web site)

Tuesday, January 15th, 2008

1347Chapter 52 .Application: Outline-Style Table of Contents Also, go back to the top of the document to see the style sheets, which have an important place in delivering an XML island: To prevent the XML block from rendering on the page, the displaystyle property is set to nonefor the XML tag selector. This keeps the page clear for insertion of script-generated HTML. The other style sheet rules apply to content created by the scripts. Setting the scripted stage All scripts for this page are in the HEAD (although they could also be linked in from an external .js file). First on the docket is establishing several global variables that get used a lot within the rest of the code and make it easy to customize important visible properties, especially widget art. Due to the art choices made for this version, there are separate versions for items that appear as first, middle, and end items for different nesting states.