Here are 2 examples of weather scripts.
The second example asks for zip code
input to reaveal your local weather!!!
ENJOY!!!
TEST these out and let me know which
one you prefer!!!!
Example #1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Weather by ZIP (IE 5 Win)</title>
<script type="text/javascript">
var zip = "";
function init()
{
svcElm = document.getElementById("weatherDiv");
svcElm.useService("http://www.vbws.com/services/weatherretriever.asmx?WSDL","Weather");
}
function doGetWeather()
{
svcElm.innerHTML = "Invoking web service..."
zip = document.forms[0].elements["zipCode"].value;
svcElm.Weather.callService("GetWeather", zip);
}
function handleResult()
{
var html = "";
var r = event.result;
if (r.error)
{
html += "A service error occured:\n\n";
html += r.errorDetail.string;
} else
{
var xml = r.raw;
var weather = [];
var fields = [
"LastUpdated",
"IconUrl",
"Conditions",
"CurrentTemp",
"Humidity",
"Barometer",
"BarometerDirection"
];
for (var i=0; i<fields.length; i++)
{
var f = fields[i];
var elm = xml.getElementsByTagName(f).item(0);
weather[fields[i]] = elm.firstChild.nodeValue;
}
html += createHTML(weather);
}
event.srcElement.innerHTML = html;
}
function createHTML(w)
{
var html = "";
html += "<img src=\"" + w.IconUrl + "\" hspace=\"6\" vspace=\"6\" border=\"0\" align=\"right\">";
html += "<p>Weather Update for <b>ZIP " + zip + "</b></p>";
html += "<p class=\"conditions\">Current Temp: " + w.CurrentTemp + "<br>";
html += "Conditions: " + w.Conditions + "<br>";
html += "Humidity: " + w.Humidity + "<br>";
html += "Barometer: " + w.Barometer + " (" + w.BarometerDirection + ")</p>";
html += "<p class=\"updated\">Updated at " + w.LastUpdated + "</p>";
return html;
}
</script>
<style type="text/css">
body {
font-family:verdana, sans serif;
font-size:12px;
}
#weatherDiv {
width:250px;
border:1px solid #aaaaaa;
padding:10px;
}
.updated {
font-size:10px;
}
</style>
</head>
<body onload="init();">
<form action="#">
<p>Enter a ZIP Code<br>
<input type="text" name="zipCode"></p>
<p><input type="button" name="getWeather" value="Get Weather" onclick="doGetWeather();"></p>
</form>
<div id="weatherDiv" style="behavior:url(webservice.htc)" onresult="handleResult()">
Weather results should appear here.
</div>
</body>
</html>
Example #2
<!-- start weather -->
<table border="0" align="center"><tr><td><table border="1" bordercolor="#6C000E" cellspacing="0" cellpadding="4" height="28" width="120"><tr><td width="116" bgcolor="#FFFBEF" height="18"><FORM ACTION="http://www.at57.com/weather/port/weather_port.php" TARGET="_blank" METHOD="GET">
<B><font size="1" face="Arial" color="#6C000E">Check Your Weather</font></b><font face="Arial" color="#6C000E"><FONT FACE="Arial" SIZE="-1"><br></font><FONT FACE="Arial" SIZE="-2">Enter your zip code</font></font><font face="Arial" color="#800000" SIZE="-2">:</font><center> <input type="text" name="zipcode" SIZE=8 MAXLENGTH=5><input type="submit" value="Go"></form><font face="Arial" size="-2"><a href="http://at57.com" target="_blank">AT57.com</a></center></font></td></tr></table></td></tr></table>
<!-- end weather -->
The KRYPTOR
