在文本/ Onfinish事件结束时刷新字幕

时间:2017-09-21 14:19:41

标签: javascript jquery html

浏览器:铬
我从xml文件获取marquee的文本。有人可以帮助如何刷新html页面并在完成滚动所有以前的数据时获得更新的xml。 即Chrome浏览器中字幕的 onfinish事件。 感谢..

<!DOCTYPE html>
<html>
<body>

<div id="bloc2" style="position: absolute; left:113px; top:9px; background-color: lightgrey; min-width: 100%; max-width: 100%; height: 30px; margin: 0px;" >
<marquee id="testone" scrolldelay=100 loop=1 style="margin-top:0px;" ></marquee>
</div>

<script>
var xhttp;
xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
        myFunction(this);
    }
};
xhttp.open("GET", "xml/News.xml", true);
xhttp.send();


function myFunction(xml) {
    var x, i,y,j,txt,text,xmlDoct; 


    xmlDoc = xml.responseXML;
    txt = "";
    x = xmlDoc.getElementsByTagName("JobName");
    for (i = 0; i < x.length; i++) { 
        txt += x[i].childNodes[0].nodeValue + "&nbsp&nbsp&nbsp&nbsp&nbsp";
    }
    document.getElementById("testone").innerHTML = text;
}

</script>

</body>
</html>

0 个答案:

没有答案