java高手们请请注意了! 比较复杂,而且处理起来耗内存比较大!除了用多线程还要用MemoryImageSource等,要自己慢慢试的! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 var datestring='中央气象台城市天气预报: 04月03日08时至04月04日08时';cw=new Array();cw[1]=new today_weather('乌鲁木齐',125,36,'23','12℃','6℃','微风',1);cw[2]=new today_weather('北京',297,68,'17','20℃','10℃','微风',1);cw[3]=new today_weather('长春',343,34,'1','21℃','4℃','微风',1);cw[4]=new today_weather('天津',304,79,'17','24℃','11℃','微风',1);cw[5]=new today_weather('西安',250,122,'108','23℃','11℃','微风',1);cw[6]=new today_weather('重庆',232,160,'23','30℃','19℃','微风',1);cw[7]=new today_weather('昆明',210,196,'3','22℃','11℃','微风',1);cw[8]=new today_weather('郑州',285,118,'23','24℃','13℃','东北风4-5级',1);cw[9]=new today_weather('上海',340,140,'4','25℃','16℃','北风转东南风4-5级',1);………………………………………………//各种天气现象列表:天气现象代号,天气现象名称,小图标名wm=new Array();wm[1]=new weather_mod('1','晴','images/sun.gif');wm[2]=new weather_mod('2','多云','images/yun.gif');wm[3]=new weather_mod('3','小雨','images/yu.gif');wm[4]=new weather_mod('4','晴转多云','images/yun.gif');………………………………………………wm[136]=new weather_mod('136','晴转阵雪','images/sun.gif');wm[137]=new weather_mod('137','冻雨转雨夹雪','images/yu.gif'); wm[138]=new weather_mod('138','阵雪转小雪','images/yu.gif'); wm[139]=new weather_mod('139','阴转大雪','images/xue.gif'); wm[140]=new weather_mod('140','小雪转雨夹雪','images/xue.gif'); function pollution(city_name,air_quatity,chief_item){ this.city_name=city_name; this.air_quatity=air_quatity; this.chief_item=chief_item;}function today_weather(city_name,pos_ltx,pos_lty,weather_id,top_tem,bottom_tem,air_pol,if_show){ this.city_name=city_name; this.pos_ltx=pos_ltx; this.pos_lty=pos_lty; this.weather_id=weather_id; this.top_tem=top_tem; this.bottom_tem=bottom_tem; this.air_pol=air_pol; this.showcity=City_show; this.if_show=if_show;}function City_show(divname,ddw,ddh,isns,n){ //cc='<a href=# onmouseover=show_detail('+n+',isns'+')><img src='+wm[this.weather_id].weather_img+' width=17 height=17 border=0 alt='+cw[n].city_name+'></a>'; if(!isns) { divname.style.left=ddw+this.pos_ltx+37; divname.style.top=ddh+this.pos_lty+148; divname.style.visibility='visible'; //divname.innerHTML=cc; } if(isns) { divname.left=ddw+this.pos_ltx+37; divname.top=ddh+this.pos_lty+148; divname.visibility='visible'; //divname.document.open(); //divname.document.write(cc); //divname.document.close(); }}function weather_mod(weather_id,weather_text,weather_img){ this.weather_id=weather_id; this.weather_text=weather_text; this.weather_img=weather_img;}divwy=new Array(20,105,158,203,250,293,341,389);isns = navigator.appName == "Netscape";function init(){ ddw=60; ddh=0; if (window.screen.width>800) {ddw=170;ddh=50;} //开始:计算日期 dt=new Date(); yy='2002'; mm=dt.getMonth()+1; dd=dt.getDate(); if(mm<10) mm="0"+mm; if(dd<10) dd="0"+dd; //结束:计算日期 if(isns) { document.back.left=ddw; document.back.top=ddh; document.loading.visibility='hidden'; document.back.visibility='visible' for(i=0;i<=7;i++) { eval('document.weath'+i+'.left=ddw+525+25'); eval('document.weath'+i+'.top=ddh+divwy['+i+']'); } with(cw[1]) { document.weath1.document.open();document.weath1.document.write('<b>'+city_name+'</b>');document.weath1.document.close(); document.weath2.document.open();document.weath2.document.write('<p>'+wm[weather_id].weather_text+'</p>');document.weath2.document.close(); document.weath3.document.open();document.weath3.document.write('<p>'+top_tem+'</p>');document.weath3.document.close(); document.weath4.document.open();document.weath4.document.write('<p>'+bottom_tem+'</p>');document.weath4.document.close(); document.weath5.document.open();document.weath5.document.write('<p>'+air_pol+'</p>');document.weath5.document.close(); document.weath6.document.open();document.weath6.document.write('<p>'+''+'</p>');document.weath6.document.close(); document.weath7.document.open();document.weath7.document.write('<p>'+''+'</p>');document.weath7.document.close(); for (j=1;j<=pw.length-1;j++) { if (pw[j].city_name==city_name) { document.weath6.document.open();document.weath6.document.write('<p>'+pw[j].air_quatity+'</p>');document.weath6.document.close(); document.weath7.document.open();document.weath7.document.write('<p>'+pw[j].chief_item+'</p>');document.weath7.document.close(); } } } document.weath0.document.open();document.weath0.document.write('<b>'+yy+'.'+mm+'.'+dd+'</b>');document.weath0.document.close(); } else { back.style.left=ddw; back.style.top=ddh; loading.style.visibility='hidden'; back.style.visibility='visible' for(i=0;i<=7;i++) { eval('weath'+i+'.style.left=ddw+525'); eval('weath'+i+'.style.top=ddh+divwy['+i+']'); } with(cw[1]) { weath1.innerHTML=city_name; weath2.innerHTML=wm[weather_id].weather_text; weath3.innerHTML=top_tem; weath4.innerHTML=bottom_tem; weath5.innerHTML=air_pol; weath6.innerHTML=''; weath7.innerHTML=''; for (j=1;j<=pw.length-1;j++) { if (pw[j].city_name==city_name) { weath6.innerHTML=pw[j].air_quatity; weath7.innerHTML=pw[j].chief_item; } } } weath0.innerHTML='<b>'+yy+'.'+mm+'.'+dd+'</b>'; } for(i=1;i<=cw.length-1;i++) { if (cw[i].if_show==1) { if(!isns) eval('cw['+i+'].showcity(city'+i+',ddw,ddh,isns,'+i+')'); else eval('cw['+i+'].showcity(document.city'+i+',ddw,ddh,isns,'+i+')'); } } } function show_detail(n,isns){ if(isns) { with(cw[n]) { document.weath1.document.open();document.weath1.document.write('<b>'+city_name+'</b>');document.weath1.document.close(); document.weath2.document.open();document.weath2.document.write('<p>'+wm[weather_id].weather_text+'</p>');document.weath2.document.close(); document.weath3.document.open();document.weath3.document.write('<p>'+top_tem+'</p>');document.weath3.document.close(); document.weath4.document.open();document.weath4.document.write('<p>'+bottom_tem+'</p>');document.weath4.document.close(); document.weath5.document.open();document.weath5.document.write('<p>'+air_pol+'</p>');document.weath5.document.close(); document.weath6.document.open();document.weath6.document.write('<p>'+''+'</p>');document.weath6.document.close(); document.weath7.document.open();document.weath7.document.write('<p>'+''+'</p>');document.weath7.document.close(); for (j=1;j<=pw.length-1;j++) { if (pw[j].city_name==city_name) { document.weath6.document.open();document.weath6.document.write('<p>'+pw[j].air_quatity+'</p>');document.weath6.document.close(); document.weath7.document.open();document.weath7.document.write('<p>'+pw[j].chief_item+'</p>');document.weath7.document.close(); } } } document.back.document.scf.scs.options[n-1].selected=true; } else { with(cw[n]) { weath1.innerHTML=city_name; weath2.innerHTML=wm[weather_id].weather_text; weath3.innerHTML=top_tem; weath4.innerHTML=bottom_tem; weath5.innerHTML=air_pol; weath6.innerHTML=''; weath7.innerHTML=''; for (j=1;j<=pw.length-1;j++) { if (pw[j].city_name==city_name) { weath6.innerHTML=pw[j].air_quatity; weath7.innerHTML=pw[j].chief_item; } } } scf.scs.options[n-1].selected=true; }} 以上只是http://www.cctv.com/weather/index.html中的部分代码(1/3都不到)——没办法,一次不能贴太多,不过也差不多了,你慢慢研究吧。 帮我看个小程序。。Java UDP连接问题 笔试题目, 大家做做 一个语句执行后让它等2秒再往下执行,怎么写?? 免费为你打工 类似C#的委托事件如何写? 如何解决java中数字到字符串的转换 结婚找工作,接着散,穷人们来接分 我的jbuilder没有声音 初学者的烦恼:编译器的选择与用法?谢谢各位大侠帮忙! 继承,重写,静态方法的混合 String和StringBuffer的具体区别是什么? 为什么这段正确的代码在j2sdk1.4下编译通不过?
cw=new Array();
cw[1]=new today_weather('乌鲁木齐',125,36,'23','12℃','6℃','微风',1);
cw[2]=new today_weather('北京',297,68,'17','20℃','10℃','微风',1);
cw[3]=new today_weather('长春',343,34,'1','21℃','4℃','微风',1);
cw[4]=new today_weather('天津',304,79,'17','24℃','11℃','微风',1);
cw[5]=new today_weather('西安',250,122,'108','23℃','11℃','微风',1);
cw[6]=new today_weather('重庆',232,160,'23','30℃','19℃','微风',1);
cw[7]=new today_weather('昆明',210,196,'3','22℃','11℃','微风',1);
cw[8]=new today_weather('郑州',285,118,'23','24℃','13℃','东北风4-5级',1);
cw[9]=new today_weather('上海',340,140,'4','25℃','16℃','北风转东南风4-5级',1);
…………
…………………………
…………//各种天气现象列表:天气现象代号,天气现象名称,小图标名
wm=new Array();
wm[1]=new weather_mod('1','晴','images/sun.gif');
wm[2]=new weather_mod('2','多云','images/yun.gif');
wm[3]=new weather_mod('3','小雨','images/yu.gif');
wm[4]=new weather_mod('4','晴转多云','images/yun.gif');
…………
…………………………
…………
wm[136]=new weather_mod('136','晴转阵雪','images/sun.gif');
wm[137]=new weather_mod('137','冻雨转雨夹雪','images/yu.gif');
wm[138]=new weather_mod('138','阵雪转小雪','images/yu.gif');
wm[139]=new weather_mod('139','阴转大雪','images/xue.gif');
wm[140]=new weather_mod('140','小雪转雨夹雪','images/xue.gif');
function pollution(city_name,air_quatity,chief_item)
{
this.city_name=city_name;
this.air_quatity=air_quatity;
this.chief_item=chief_item;
}function today_weather(city_name,pos_ltx,pos_lty,weather_id,top_tem,bottom_tem,air_pol,if_show)
{
this.city_name=city_name;
this.pos_ltx=pos_ltx;
this.pos_lty=pos_lty;
this.weather_id=weather_id;
this.top_tem=top_tem;
this.bottom_tem=bottom_tem;
this.air_pol=air_pol;
this.showcity=City_show;
this.if_show=if_show;
}function City_show(divname,ddw,ddh,isns,n)
{
//cc='<a href=# onmouseover=show_detail('+n+',isns'+')><img src='+wm[this.weather_id].weather_img+' width=17 height=17 border=0 alt='+cw[n].city_name+'></a>';
if(!isns)
{
divname.style.left=ddw+this.pos_ltx+37;
divname.style.top=ddh+this.pos_lty+148;
divname.style.visibility='visible';
//divname.innerHTML=cc;
}
if(isns)
{
divname.left=ddw+this.pos_ltx+37;
divname.top=ddh+this.pos_lty+148;
divname.visibility='visible';
//divname.document.open();
//divname.document.write(cc);
//divname.document.close();
}
}function weather_mod(weather_id,weather_text,weather_img)
{
this.weather_id=weather_id;
this.weather_text=weather_text;
this.weather_img=weather_img;
}divwy=new Array(20,105,158,203,250,293,341,389);
isns = navigator.appName == "Netscape";function init()
{
ddw=60;
ddh=0;
if (window.screen.width>800) {ddw=170;ddh=50;}
//开始:计算日期
dt=new Date();
yy='2002';
mm=dt.getMonth()+1;
dd=dt.getDate();
if(mm<10) mm="0"+mm;
if(dd<10) dd="0"+dd;
//结束:计算日期
if(isns)
{
document.back.left=ddw;
document.back.top=ddh;
document.loading.visibility='hidden';
document.back.visibility='visible'
for(i=0;i<=7;i++)
{
eval('document.weath'+i+'.left=ddw+525+25');
eval('document.weath'+i+'.top=ddh+divwy['+i+']');
}
with(cw[1])
{
document.weath1.document.open();document.weath1.document.write('<b>'+city_name+'</b>');document.weath1.document.close();
document.weath2.document.open();document.weath2.document.write('<p>'+wm[weather_id].weather_text+'</p>');document.weath2.document.close();
document.weath3.document.open();document.weath3.document.write('<p>'+top_tem+'</p>');document.weath3.document.close();
document.weath4.document.open();document.weath4.document.write('<p>'+bottom_tem+'</p>');document.weath4.document.close();
document.weath5.document.open();document.weath5.document.write('<p>'+air_pol+'</p>');document.weath5.document.close();
document.weath6.document.open();document.weath6.document.write('<p>'+''+'</p>');document.weath6.document.close();
document.weath7.document.open();document.weath7.document.write('<p>'+''+'</p>');document.weath7.document.close();
for (j=1;j<=pw.length-1;j++)
{
if (pw[j].city_name==city_name)
{ document.weath6.document.open();document.weath6.document.write('<p>'+pw[j].air_quatity+'</p>');document.weath6.document.close();
document.weath7.document.open();document.weath7.document.write('<p>'+pw[j].chief_item+'</p>');document.weath7.document.close();
}
}
}
document.weath0.document.open();document.weath0.document.write('<b>'+yy+'.'+mm+'.'+dd+'</b>');document.weath0.document.close();
}
else
{
back.style.left=ddw;
back.style.top=ddh;
loading.style.visibility='hidden';
back.style.visibility='visible'
for(i=0;i<=7;i++)
{
eval('weath'+i+'.style.left=ddw+525');
eval('weath'+i+'.style.top=ddh+divwy['+i+']');
}
with(cw[1])
{
weath1.innerHTML=city_name;
weath2.innerHTML=wm[weather_id].weather_text;
weath3.innerHTML=top_tem;
weath4.innerHTML=bottom_tem;
weath5.innerHTML=air_pol;
weath6.innerHTML='';
weath7.innerHTML='';
for (j=1;j<=pw.length-1;j++)
{
if (pw[j].city_name==city_name)
{ weath6.innerHTML=pw[j].air_quatity;
weath7.innerHTML=pw[j].chief_item;
}
}
}
weath0.innerHTML='<b>'+yy+'.'+mm+'.'+dd+'</b>';
}
for(i=1;i<=cw.length-1;i++)
{
if (cw[i].if_show==1)
{
if(!isns)
eval('cw['+i+'].showcity(city'+i+',ddw,ddh,isns,'+i+')');
else
eval('cw['+i+'].showcity(document.city'+i+',ddw,ddh,isns,'+i+')');
}
}
} function show_detail(n,isns)
{
if(isns)
{
with(cw[n])
{
document.weath1.document.open();document.weath1.document.write('<b>'+city_name+'</b>');document.weath1.document.close();
document.weath2.document.open();document.weath2.document.write('<p>'+wm[weather_id].weather_text+'</p>');document.weath2.document.close();
document.weath3.document.open();document.weath3.document.write('<p>'+top_tem+'</p>');document.weath3.document.close();
document.weath4.document.open();document.weath4.document.write('<p>'+bottom_tem+'</p>');document.weath4.document.close();
document.weath5.document.open();document.weath5.document.write('<p>'+air_pol+'</p>');document.weath5.document.close();
document.weath6.document.open();document.weath6.document.write('<p>'+''+'</p>');document.weath6.document.close();
document.weath7.document.open();document.weath7.document.write('<p>'+''+'</p>');document.weath7.document.close();
for (j=1;j<=pw.length-1;j++)
{
if (pw[j].city_name==city_name)
{ document.weath6.document.open();document.weath6.document.write('<p>'+pw[j].air_quatity+'</p>');document.weath6.document.close();
document.weath7.document.open();document.weath7.document.write('<p>'+pw[j].chief_item+'</p>');document.weath7.document.close();
}
}
}
document.back.document.scf.scs.options[n-1].selected=true;
}
else
{
with(cw[n])
{
weath1.innerHTML=city_name;
weath2.innerHTML=wm[weather_id].weather_text;
weath3.innerHTML=top_tem;
weath4.innerHTML=bottom_tem;
weath5.innerHTML=air_pol;
weath6.innerHTML='';
weath7.innerHTML='';
for (j=1;j<=pw.length-1;j++)
{
if (pw[j].city_name==city_name)
{ weath6.innerHTML=pw[j].air_quatity;
weath7.innerHTML=pw[j].chief_item;
}
}
}
scf.scs.options[n-1].selected=true;
}
}