|
|
Search Tutorials
The Actionscript: findUrl functionAs in the previous example we now have to get the individual contents of the xml file using a function with a new argument thisUrl.
function findUrl(thisUrl) {
We loop through the XML content to find all the childnodes and create the variable urlName, which holds the nodenames. We always set the contents to lower case, since by this way the search becomes case insensitive.
for (var count02=0; count02<=thisUrl.childNodes.length; count02++) {
//we are defining the var modelName here
urlName = thisUrl.childNodes[count02].nodeName.toLowerCase();
We now compare the input from the input textfield with urlName and at the same time exclude undefined childnodes. This is important if the user clicks on the submit button and there is no text in the input field.
//the string from the input textfield is compared
//with the name of the childnodes
//we exclude undefined childnodes from the search
if (searchWindow.toLowerCase() == urlName && urlName != undefined) {
|
||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||
|