/*check for market ticker container*/ var mtContainer = document.getElementById('mtContainer'); var mtShowDap = false; if (mtContainer != null) { var dxMktTick = {}; (function () { var randnum = Math.floor(Math.random() * 1000001); var maxSymbols = 3; var hookclass = "mkttr"; var $d = {}; var $m_o = ""; function clearForm(input) { if (input.value != "") { input.value = ""; } } function formAction() { var sym = document.getElementById("symbol").value; document.getQuote.action = "http://data.cnbc.com/quotes/" + sym; } function makeTicker() { /*Start grid cells and structure*/ $m_o += '
'; $m_o += '
Markets'; $m_o += '
Quotes delayed 15+ min.
'; $m_o += '
'; /*for each quote called, build the quote's markup*/ for (var i = 0; i < $d.quotes.length; i++) { var s = $d.quotes[i]; /*arrows logic*/ if (s.last == "NaN" || s.last == NaN) { /*if no data, show no arrow or name*/ s.arrow = "unch"; s.sym = "-"; s.name = "
"; } /*symbol and arrows*/ $m_o += '
'; $m_o += ''; /*symbol name corrections*/ if (s.sym == "$DJI" || s.sym == "I:DJI") { s.sname = "Dow industrials"; } if (s.sym == "$COMP" || s.sym == "I:COMP") { s.sname = "Nasdaq"; } $m_o += s.sname + ''; /*symbol data*/ if (s.last == "NaN" || s.last == NaN) { /*if no data, show polite error*/ $m_o += 'Temporarily unavailable

'; } else { $m_o += '' + s.change + ' ' + s.pct + '
last ' + s.last + '
'; $m_o += '
'; } } /*wrap up grid with stock-query form*/ $m_o += '
'; $m_o += ''; $m_o += ''; //move the ad logo to right side below search box $m_o += '
Sponsored by
'; $m_o += '
'; //close the market ticker div $m_o += ''; /*inject into specified 'hole' in the UI*/ var rt = document.getElementById('mtContainer'); if (rt != null) { var ct = mtContainer.innerHTML; mtContainer.innerHTML = ct + $m_o; } //set flag to display the market ticker dap ad mtShowDap = true; setTimeout("mtCreateDap()", 1000); } function onLoad() { $d = DBMgr.def.getData(); if ($d == null || $d == undefined) { return; } else if ($d.quotes == null || $d.quotes == undefined) { return; } makeTicker(); } dxMktTick.clearForm = clearForm; dxMktTick.formAction = formAction; dxMktTick.onLoad = onLoad; })(); if (DBMgr.hasLoaded() == true) { dxMktTick.onLoad(); } else { DBMgr.subscribe(dxMktTick.onLoad); } //close rt!= null if condition } $( document ).ready(function() { $("a[href='http://www.nbcnews.com/id/31260763/ns/business-markets?q=I:DJI']").attr('href', 'http://data.cnbc.com/quotes/.DJI'); $("a[href='http://www.nbcnews.com/id/31260763/ns/business-markets?q=I:COMP']").attr('href', 'http://data.cnbc.com/quotes/.IXIC'); $("a[href='http://www.nbcnews.com/id/31260763/ns/business-markets?q=SPX.X']").attr('href', 'http://data.cnbc.com/quotes/.SPX'); });