tyle(). We just pass it the element, (Web hosting mysql) the
tyle(). We just pass it the element, the IE name for the attribute, and the Mozilla name for the attribute, and the method returns a value. Our method here gets the values of the left and right borders and margins, sums them up, and returns them. The Rico.getElementsComputedStyle() is known to have issues with some ver- sions of Safari, and so we provide a default return value within a try…catch block. Creating the pop-up contents Now that we have the code to create and position the pop-up, we need to write a method to populate it with actual suggestions before it can be useful. Recall that our ajaxUpdate() method parses the XML from the response into an array of sug- gestion objects. And, if at least one suggestion exists, it calls a method named this.updateSugggestionsDiv(). This method is the transformer of the in-memory collection of suggestions to actual SPAN elements within the pop-up div. Let s look at how that s done now: updateSuggestionsDiv: function() { Remove prior content this.suggestionsDiv.innerHTML = “”; var suggestLines = this.createSuggestionSpans(); Create new for (var i = 0; i < suggestLines.length; i++) content this.suggestionsDiv.appendChild(suggestLines[i]); }, This method is deceptively simple, but there s still lots of work to do, so hang with us. This method simply sets the value of the innerHTML property of the sugges- tionsDiv created earlier to an empty string in order to wipe out any prior con- tent. Then it calls createSuggestionSpans() to create a span for each suggestion in the suggestions array. Finally, it iterates over the created spans and appends them to the div. This is where the real work starts. Let s continue by looking at createSuggestionSpans() in listing 10.36 to see what s involved in creating them. Listing 10.36 Creation of suggestion list items createSuggestionSpans: function() { var regExpFlags = ""; if ( this.options.ignoreCase ) regExpFlags = i ;
Check Tomcat Web Hosting services for best quality webspace to host your web application.