Weather forecast
Open with FP7, fp8 have safe sand box, Demo effect screenshot as follows:
Click here to download the source file
/*////////////////////////
/*
/*
/* by Yellow
/* yellowboydesign@gmail.com
/* http://yellowboy.cn
/*
*/
///////////////////////
Stop ();
System.usecodepage = true;
FPV_CN = new Loadvars ();
Fpv_cn.load ("http://www.tq121.com.cn/forecast/cf.php");
Fpv_cn_weather = new Array ();
tempcity = new Array ();
TEMPW = new Array ();
Temphot = new Array ();
Tempwind = new Array ();
Tempwinds = new Array ();
Fpv_cn_out = "<br>";
fpv_cn_city = "City:";
Fpv_cn_w = "weather:";
Fpv_cn_hot = "Temperature:";
Fpv_cn_wind = "Wind Direction:";
Fpv_cn_winds = "Wind:";
Fpv_cn.ondata = function (data) {
Fpv_cn_str = new String (data);
For (i=7500 i<fpv_cn_str.length; i++) {
City
if (Fpv_cn_str.slice (i, i+fpv_cn_city.length) = = fpv_cn_city) {
For (J=i j<i+10; j + +) {
if (Fpv_cn_str.slice (j, j+fpv_cn_out.length) = = Fpv_cn_out) {
Tempcity.push (Fpv_cn_str.slice (I+fpv_cn_city.length, j-1));
Break
}
}
}
Weather
if (Fpv_cn_str.slice (i, i+fpv_cn_w.length) = = Fpv_cn_w) {
For (k=i k<i+10; k++) {
if (Fpv_cn_str.slice (k, k+fpv_cn_out.length) = = Fpv_cn_out) {
Tempw.push (Fpv_cn_str.slice (I+fpv_cn_w.length, k));
Break
}
}
}
Temperature
if (Fpv_cn_str.slice (i, i+fpv_cn_hot.length) = = Fpv_cn_hot) {
For (l=i l<i+15; l++) {
if (Fpv_cn_str.slice (l, l+fpv_cn_out.length) = = Fpv_cn_out) {
Temphot.push (Fpv_cn_str.slice (I+fpv_cn_hot.length, L));
Break
}
}
}
Wind
if (Fpv_cn_str.slice (i, i+fpv_cn_wind.length) = = Fpv_cn_wind) {
For (m=i m<i+10; m++) {
if (Fpv_cn_str.slice (m, m+fpv_cn_out.length) = = Fpv_cn_out) {
Tempwind.push (Fpv_cn_str.slice (I+fpv_cn_wind.length, M));
Break
}
}
}
Wind
if (Fpv_cn_str.slice (i, i+fpv_cn_winds.length) = = Fpv_cn_winds) {
For (n=i n<i+15; n++) {
if (Fpv_cn_str.slice (n, n+fpv_cn_out.length) = = Fpv_cn_out) {
Tempwinds.push (Fpv_cn_str.slice (I+fpv_cn_winds.length, N));
Break
}
}
}
}
Put in an array
City: Cities, W: weather, hot: temperature, Wind: direction, winds: Wind
For (o=0 o<tempcity.length; o++) {
Fpv_cn_weather.push ({City:tempcity[o], w:tempw[o], Hot:temphot[o], Wind:tempwind[o], Winds:tempwinds[o]};
}
Sort
Fpv_cn_weather.sorton ("City");
Play ();
};