/* DOM XML ticker- © Dynamic Drive (www.dynamicdrive.com) For full source code, 100's more DHTML scripts, and Terms Of Use, visit http://www.dynamicdrive.com Credit MUST stay intact */ //Container for ticker. Modify its STYLE attribute to customize style: var item_id_prefix='listFirstChild_0_' var container_id='list_0' var tickercontainer='
' var items_class = 'content' var container = '' //Specify path to xml file var xmlsource="components/news_feed_xml.jsp" var parent_element="news_data" var item_count = 0 var curr_item = 0 var change = 1 //pixels to move per frame var do_scroll = true //animation controller ////No need to edit beyond here//////////// //load xml file if (window.ActiveXObject) var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); else if (document.implementation && document.implementation.createDocument) var xmlDoc= document.implementation.createDocument("","doc",null); if (typeof xmlDoc!="undefined"){ document.write(tickercontainer) container = document.getElementById(container_id) xmlDoc.load(xmlsource) } if (window.ActiveXObject) { fetchxml(); } else if (typeof xmlDoc!="undefined") { window.onload = function() { init_ticker(); } } //Regular expression used to match any non-whitespace character var notWhitespace = /\S/ function init_ticker(){ //Cache "messages" element of xml file news_ticker=xmlDoc.getElementsByTagName(parent_element)[0] //REMOVE white spaces in XML file. Intended mainly for NS6/Mozilla for (i=0;i' + item_object.getElementsByTagName('hdr')[0].firstChild.nodeValue + '' var item_date = '
' + item_object.getElementsByTagName('date')[0].firstChild.nodeValue + '
' var item_teaser = '
' + item_object.getElementsByTagName('teaser')[0].firstChild.nodeValue + '
' var the_item = item_date + item_hdr + item_teaser; //Rotate msg and display it in DIV: document.getElementById(item_id_prefix + '' + item_id).innerHTML=the_item the_item='' } function fetchxml(){ if (xmlDoc.readyState==4) { window.onload = function() { init_ticker(); } } else { setTimeout("fetchxml()",10); } } container.onmouseover=function() { do_scroll = false; } container.onmouseout=function() { do_scroll = true; } function scroll(){ var to_focus = news_ticker.childNodes[curr_item-1] var focus_id = to_focus.getAttribute('id') var focus_item = document.getElementById(item_id_prefix + '' + focus_id) var on_complete = function() { if (curr_item-parseInt(target_item.clientHeight+change) || target_item.clientHeight == 0){ setTimeout(function(){this.scroll_item(target_item, on_complete)}, 50) } else { on_complete(); } } function shift_item(element) { //take the item, move it to the end of the div list container.appendChild(element); //clear the top and marginBottom styles element.style.top = '0px'; element.style.marginBottom = '0px'; }