-- 作者:yangbobo
-- 发布时间:10/14/2004 11:31:00 PM
-- 有获取远程xml文件,但不懂如何移植过来,请超级大虾解决。
我想获取 http://www.18638.com/Data.xml数据,但下列文件在本机运行可以获得本机的data.xml文件,就是不能获得远程data.xml文件。 请哪位大虾帮帮忙,把下来的文件改成可以获得远程数据的文件,我在这里谢谢各位了!!!!!! 我看了这篇文章,做成功了。但不知如何移植过来。供参考。http://www.wrclub.net/study/listarticle.aspx?id=2682 <script language="javascript"> document.write("<XML ID=\"xmldso\"></XML>"); var oldmacauslot,trcolor,macauslotcol,omcount=""; var xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); var oddchangeA=" <OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' WIDTH='10' HEIGHT='10'><PARAM NAME=movie VALUE='swf/odds_changeA.swf'><param name='scale' value='ExactFit'><param name='Menu' value='false'><param name='wmode' value='transparent'></OBJECT>"; var oddchangeB=" <OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' WIDTH='10' HEIGHT='10'><PARAM NAME=movie VALUE='swf/odds_changeB.swf'><param name='scale' value='ExactFit'><param name='Menu' value='false'><param name='wmode' value='transparent'></OBJECT>"; var showoddsDN=" <OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' WIDTH='10' HEIGHT='10'><PARAM NAME=movie VALUE='swf/odds_changeC.swf'><param name='scale' value='ExactFit'><param name='Menu' value='false'><param name='wmode' value='transparent'></OBJECT>"; var loadData=0; function readXMLfirst(){xmlDoc.load("Data.xml");xmlDoc.onreadystatechange=showoddsfirst;if(loadData==0){window.setTimeout("readXMLfirst()",2000);}else{readXML();}} function showoddsfirst(){ if (xmlDoc.readyState!=4){return;} try{ xmldso.XMLDocument.async="false"; xmldso.XMLDocument.loadXML(xmlDoc.xml); var rootElement=xmlDoc.documentElement; var macauslot=rootElement.childNodes[1]; macauslotcol=macauslot.childNodes.length; macauslotrow=macauslot.childNodes[0].attributes.length; maintxt=""; trcount=""; for(i=0;i<macauslotcol;i++){ if(trcount==1){trcolor=" bgcolor=white";trcount="";}else{trcolor=" bgcolor=#EEEEEE";trcount=1;}; macauslotbet=macauslot.childNodes[i]; matchSS=macauslotbet.attributes[2].nodeValue.replace("\"","").replace("\"",""); team_nameAA=macauslotbet.attributes[3].nodeValue.split("*"); matchColor=macauslotbet.attributes[9].nodeValue; matchID=macauslotbet.attributes[0].nodeValue; indexID=macauslotbet.attributes[8].nodeValue; team_nameA=macauslotbet.attributes[3].nodeValue.replace("*","(主)"); team_nameB=macauslotbet.attributes[4].nodeValue.replace("*","(主)"); team_oddsA=macauslotbet.attributes[6].nodeValue; team_oddsB=macauslotbet.attributes[7].nodeValue; team_oddsTDA="id='OMODDSA_"+matchID+"'"; team_oddsTDB="id='OMODDSB_"+matchID+"'"; graphicsname=macauslotbet.attributes[3].nodeValue.replace("*",""); maintxt=maintxt+"<tr height=40 "+trcolor+">"; maintxt=maintxt+"<td class='T2' style='color:white;background-color:"+matchColor+";'>"+matchSS.substr(0,10)+"<br>"+macauslotbet.attributes[1].nodeValue+"<span id='CHANGE_"+matchID+"'></span>"; maintxt=maintxt+"<td class='T2'>"+team_nameA+"<br><span class='ODDS' "+team_oddsTDA+">"+team_oddsA+"</span><span id='OMGBA_"+matchID+"'></span>"; maintxt=maintxt+"<td class='T2'><span id='macthODDS_"+matchID+"'>"+macauslotbet.attributes[5].nodeValue+"</span><br><a href=\"graphics.htm?id="+indexID+",itemname='"+graphicsname+"'\" target='zqzz_oddsgraphics'>走势图</a>"; maintxt=maintxt+"<td class='T2'>"+team_nameB+"<br><span class='ODDS' "+team_oddsTDB+">"+team_oddsB+"</span><span id='OMGBB_"+matchID+"'></span></tr>"; } content.innerHTML="<table border=1 class='T1' cellspacing=0 cellpadding=0 bordercolor='#DDDDDD'><tr style='text-align:center;color:#FFFFFF;background-color:#CC0000' height=25><td width=110>开赛时间<td width=130><td width=75>让球(左让右)<td width=130></tr>"+maintxt+"</table>"; if(omcount != macauslotcol){omcount=macauslotcol;loadData=1;} }catch(a){} } readXMLfirst(); function converColor(cc){ color="green"; for(k=0;k<=match_type.length;k++){ if(match_type[k]==cc){color=matchcolor[k];break;} } return color; } function readXML(){ xmlDoc.load("Data.xml"); xmlDoc.onreadystatechange=showodds; window.setTimeout("readXML()",4000);} function showodds(){ if (xmlDoc.readyState!=4){return;} try{ xmldso.XMLDocument.async="false"; xmldso.XMLDocument.loadXML(xmlDoc.xml); if(xmlDoc.xml==""){return;} if(oldmacauslot==xmlDoc.xml){return;} rootElement=xmlDoc.documentElement; macauslot=rootElement.childNodes[1]; macauslotcol=macauslot.childNodes.length; if(omcount != macauslotcol){showoddsfirst();} macauslotrow=macauslot.childNodes[0].attributes.length; for(i=0;i<macauslotcol;i++){ d = new Date(); macauslotbet=macauslot.childNodes[i]; id_om=macauslotbet.attributes[0].nodeValue; if(document.all["OMODDSA_"+id_om].innerText != macauslotbet.attributes[6].nodeValue) { if(showgoal_s.checked){showoddsUP=oddchangeB;}else{showoddsUP=oddchangeA;} team_nameAA=macauslotbet.attributes[3].nodeValue.split("*"); team_nameA=macauslotbet.attributes[3].nodeValue.replace("\"","").replace("*","")+"(主)"; team_nameB=macauslotbet.attributes[4].nodeValue.replace("\"","").replace("\"","").replace("*",""); team_oddsA=macauslotbet.attributes[6].nodeValue; team_oddsB=macauslotbet.attributes[7].nodeValue; old_oddsA=document.all["OMODDSA_"+id_om].innerText; old_oddsB=document.all["OMODDSB_"+id_om].innerText; if(document.all["macthODDS_"+id_om].innerText != macauslotbet.attributes[5].nodeValue){document.all["macthODDS_"+id_om].innerText=macauslotbet.attributes[5].nodeValue;} document.all["CHANGE_"+id_om].innerHTML="<img src='images/new.gif' border=0 align='absMiddle' height=10>"; if(document.all["OMODDSA_"+id_om].innerText < macauslotbet.attributes[6].nodeValue) { if(team_nameAA.length>1){omgb_A=showoddsUP;omgb_B=showoddsDN;}else{omgb_B=showoddsUP;omgb_A=showoddsDN;} document.all["OMODDSA_"+id_om].style.color="red"; document.all["OMODDSB_"+id_om].style.color="green"; }else{ if(team_nameAA.length>1){omgb_B=showoddsUP;omgb_A=showoddsDN;}else{omgb_A=showoddsUP;omgb_B=showoddsDN;} document.all["OMODDSA_"+id_om].style.color="green"; document.all["OMODDSB_"+id_om].style.color="red"; } document.all["OMGBA_"+id_om].innerHTML=omgb_A; document.all["OMGBB_"+id_om].innerHTML=omgb_B; document.all["OMODDSA_"+id_om].innerText=macauslotbet.attributes[6].nodeValue; document.all["OMODDSB_"+id_om].innerText=macauslotbet.attributes[7].nodeValue; window.setTimeout("showTheText("+id_om+")",60000); showchangetext("<table border=1 width='100%' class='T1' style='line-height:24 px;' cellpadding=2 bgcolor=white bordercolor='#DDDDDD'><tr><td width='39%' class='T2'>"+team_nameA+"<td width='22%' class='T2'>【澳门】<td width='39%' class='T2'>"+team_nameB+"<tr><td class='T2'>"+old_oddsA+" → "+team_oddsA+omgb_A+"<td class='T2'>"+macauslotbet.attributes[5].nodeValue+"<td class='T2'>"+old_oddsB+" → "+team_oddsB+omgb_B+"</table>"); } } }catch(b){} oldmacauslot=xmlDoc.xml; } function showTheText(textid){ document.all["OMODDSA_"+textid].style.color=""; document.all["OMODDSB_"+textid].style.color=""; document.all["CHANGE_"+textid].innerText=document.all["OMGBA_"+textid].innerText=document.all["OMGBB_"+textid].innerText=""; } function showchangetext(MM) { document.all.zqzz_showgoaltext.insertAdjacentHTML("afterEnd",MM); } </script>
|