function FindXMLStuff( XMLstr, pattern ) { // FindXMLStuff var results = new Array( ); var res; var pattern2 = new RegExp( "<" + pattern + "(\\s[^>]+)?>(.*?)<\\/" + pattern + ">", "g" ); while ( ( res = pattern2.exec( XMLstr ) ) ) { if ( 0 == results.length ) { results[ 0 ] = ("undefined" == typeof res[ 1 ] ) ? "" : TrimString( res[ 1 ] ); } results[ results.length ] = res[ 2 ]; } return results; } // FindXMLStuff function weatherSuccess( o ) { // weatherSuccess /* * Try another approach here. Grab things from the XML using regex's */ var theXML = o.responseText; var webURL = FindXMLStuff( theXML, "aws:WebURL" )[ 1 ]; var title = FindXMLStuff( theXML, "title" ); var lastBuildDate = FindXMLStuff( theXML, "lastBuildDate" ); var forecasts = FindXMLStuff( theXML, "aws:forecasts" ); var forecast = FindXMLStuff( theXML, "aws:forecast" ); var city = FindXMLStuff( theXML, "aws:city" ); var state = FindXMLStuff( theXML, "aws:state" ); var table = ""; var altTitle; var altTitlePattern = new RegExp( 'alttitle="([A-Z]{3})"' ); var weatherIcon; var shortPrediction; var highTemp; var lowTemp; var forecastText; var tmp; table += '' + city[ 1 ] + ", " + state[ 1 ] + ""; table += ''; for ( ndx = 1; ndx <= 4; ndx++ ) { forecastText = forecast[ ndx ]; tmp = FindXMLStuff( forecastText, "aws:title" )[ 0 ]; altTitle = altTitlePattern.exec( tmp )[ 1 ]; weatherIcon = FindXMLStuff( forecastText, "aws:image" )[ 1 ]; shortPrediction = FindXMLStuff( forecastText, "aws:short-prediction" )[ 1 ]; highTemp = FindXMLStuff( forecastText, "aws:high" )[ 1 ]; lowTemp = FindXMLStuff( forecastText, "aws:low" )[ 1 ]; table += '"; } table += '
'; table += altTitle + "
"; table += '' + 'Weather Picture
'; table += shortPrediction + "
"; table += '' + highTemp + "° / "; table += '' + lowTemp + "°"; table += "
'; table += '' + 'Click on icon above for detailed weather ' + ''; var weatherDiv = document.getElementById( "WeatherParking" ); weatherDiv.innerHTML = table; } // weatherSuccess function weatherFailure(o) { var weatherDiv = document.getElementById( "WeatherParking" ); weatherDiv.innerHTML = o.status + " " + o.statusText; } function getWeatherModule( iZip ) { // getWeatherModule //var iZip = oForm.elements['zip'].value; var entryPoint = '/json/weather.proxy.php'; var queryString = encodeURI( "?zipCode=" + iZip); var sUrl = entryPoint + queryString; var request = YAHOO.util.Connect.asyncRequest( "GET", sUrl, { success: weatherSuccess, failure: weatherFailure } ); } // getWeatherModule