</section> <!--time end--> <section class="demo arc"> <!-- Lable 1 --> <div class="pre_cont_div" id="pre"> <script src="js/soccer/soccer_odds2.js"></script> 《!---要 显示的内容--》 </div> </section> js/soccer/soccer_odds2.js--- var country = decodeURI(decodeURI(mc));if (window.ActiveXObject) { oXmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); oXmlHttp1 = new ActiveXObject("Microsoft.XMLHTTP"); oXmlHttp2 = new ActiveXObject("Microsoft.XMLHTTP"); oXmlHttp5 = new ActiveXObject("Microsoft.XMLHTTP"); } else if (window.XMLHttpRequest) { oXmlHttp = new XMLHttpRequest(); oXmlHttp1 = new XMLHttpRequest(); oXmlHttp2 = new XMLHttpRequest(); oXmlHttp5 = new XMLHttpRequest(); } function CreateXMLroot() { oXmlHttp1.open( "GET", "xml/odds_config.xml", false ) ; oXmlHttp1.send(null) ; oddsrootnode = oXmlHttp1.responseXML.documentElement; oXmlHttp2.open( "GET", "xml/odds.xml", false ) ; oXmlHttp2.send(null) ; oddsrootnode2 = oXmlHttp2.responseXML.documentElement;oXmlHttp5.open( "GET", "xml/predictions.xml", false ) ; oXmlHttp5.send(null) ; oddsrootnode5 = oXmlHttp5.responseXML.documentElement;} CreateXMLroot() var nowtimetry=document.getElementById('tew').innerHTML.toString(); var datas = new Array(); //存储实体的数组 if(oddsrootnode) { var nodes;
if(country.length!=0){ var nodes = oddsrootnode.selectNodes("//Fixtures/Fixture[@tt='"+country+"' and @s="+2+" and (contains(@gt,'" + nowtimetry+ "'))]");
var nodes = oddsrootnode.selectNodes("//Fixtures/Fixture[(@s=2) and (contains(@gt,'" + nowtimetry+ "'))]");// }
for(var it=0;it<nodes.length;it++) {
var node_id=nodes[it].attributes["id"].value;//ID var date=nodes[it].attributes["gt"].value; var dateymd=date.substring(0,8); var datetime=date.substring(9,14);
《html》 <!--time begin-->
<section class="c-time">
<script>
document.writeln("<div class=\"showtime\"><div id=\"tew\" style=\"display:none;\">"+GetDateStr(0)+"</div><div id=\"livetime\" style=\"display:none;\">"+GetDateStr3(0)+"</div><div id=\"nowtime\" >"+GetDateStr2(0)+"</div></div>");
</script>《!---时间--》
<!--button-->
<div class="prev-time" id="prev-timet"><img src="images/history_back.png"></div>
<div class="next-time" id="next-timet"><img src="images/history_back2.png"></div>
<!--button end-->
</section>
<!--time end-->
<section class="demo arc">
<!-- Lable 1 -->
<div class="pre_cont_div" id="pre">
<script src="js/soccer/soccer_odds2.js"></script> 《!---要 显示的内容--》
</div>
</section>
js/soccer/soccer_odds2.js---
var country = decodeURI(decodeURI(mc));if (window.ActiveXObject) {
oXmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
oXmlHttp1 = new ActiveXObject("Microsoft.XMLHTTP");
oXmlHttp2 = new ActiveXObject("Microsoft.XMLHTTP");
oXmlHttp5 = new ActiveXObject("Microsoft.XMLHTTP");
}
else
if (window.XMLHttpRequest) {
oXmlHttp = new XMLHttpRequest();
oXmlHttp1 = new XMLHttpRequest();
oXmlHttp2 = new XMLHttpRequest();
oXmlHttp5 = new XMLHttpRequest();
}
function CreateXMLroot()
{
oXmlHttp1.open( "GET", "xml/odds_config.xml", false ) ;
oXmlHttp1.send(null) ;
oddsrootnode = oXmlHttp1.responseXML.documentElement; oXmlHttp2.open( "GET", "xml/odds.xml", false ) ;
oXmlHttp2.send(null) ;
oddsrootnode2 = oXmlHttp2.responseXML.documentElement;oXmlHttp5.open( "GET", "xml/predictions.xml", false ) ;
oXmlHttp5.send(null) ;
oddsrootnode5 = oXmlHttp5.responseXML.documentElement;}
CreateXMLroot() var nowtimetry=document.getElementById('tew').innerHTML.toString(); var datas = new Array(); //存储实体的数组
if(oddsrootnode)
{
var nodes;
if(country.length!=0){
var nodes = oddsrootnode.selectNodes("//Fixtures/Fixture[@tt='"+country+"' and @s="+2+" and (contains(@gt,'" + nowtimetry+ "'))]");
if(nodes.length==0){ alert("对不起!该赛事没有任何信息!");window.location.href="odds-test.html";}
}
else{
var nodes = oddsrootnode.selectNodes("//Fixtures/Fixture[(@s=2) and (contains(@gt,'" + nowtimetry+ "'))]");//
}
for(var it=0;it<nodes.length;it++)
{
var node_id=nodes[it].attributes["id"].value;//ID
var date=nodes[it].attributes["gt"].value;
var dateymd=date.substring(0,8);
var datetime=date.substring(9,14);
//賽事全稱
function time() {
var prevtime= document.getElementById('prev-timet');
var nexttime=document.getElementById('next-timet');
prevtime.onclick=function(){
var nowtimey=document.getElementById('tew').innerHTML.toString();
var time8=GetDateStr(0);
var timetimel=[parseInt(nowtimey,10)-1];
var timelength=time8-timetimel;
if(timelength<7){
document.getElementById('tew').innerHTML=timetimel;
var i=-timelength;
var timetime2=GetDateStr2(i);
document.getElementById('nowtime').innerHTML=timetime2;
var timetime3=GetDateStr3(i);
document.getElementById('livetime').innerHTML=timetime3; }
};
nexttime.onclick=function(){
var nowtimey=document.getElementById('tew').innerHTML.toString(); var time8=GetDateStr(0);
var timetimel=[parseInt(nowtimey,10)+1];
var timelength=timetimel-time8;
if(timelength<7){
document.getElementById('tew').innerHTML=timetimel;
var i=timelength;
var timetime2=GetDateStr2(i);
document.getElementById('nowtime').innerHTML=timetime2;
var timetime3=GetDateStr3(i);
document.getElementById('livetime').innerHTML=timetime3;
}
};
};我是这样写的--直接改变div的值--可是我要获得这个div每次变化的值来做判断。。怎样做啊
$(‘#prev-timet’).click(function(){
//写你的业务逻辑
})
})控件事件的绑定一定要放在页面初始化函数中,直接在控件上绑定事件,而不要把控件赋给一个变量再绑定事件