function renderAllData() { renderIndices(); } ///// Data Declarations ///// function security(name, symbol, value, movement, percentMovement, volume) { // Represents a security object this.name = name; this.symbol = symbol; this.value = value; this.movement = movement; this.percentMovement = percentMovement; this.volume = volume; } var indices = new Array(); ///// Data values ///// indices[0] = new security('Nikkei','US.^NI225','9080.840','37.720','0.42','0',''); indices[1] = new security('FTSE','LSE.UKX','4638.920','59.280','1.29','0',''); indices[2] = new security('DJIA','US.^DJI','9015.100','62.210','0.70','0',''); indices[3] = new security('NASDAQ','US.^COMP','1628.030','-4.180','-0.26','0',''); indices[4] = new security('H.SENG','US.^HSI','15372.100','141.230','0.93','0',''); indices[5] = new security('S&P500','US.^SPX','934.700','7.250','0.78','0',''); indices[6] = new security('ALLORDS','ASX.XAO','3689.200','50.300','1.38','1022294356',''); ///// Render functions ///// // (you can use your own if you like) function startTable(caption, columns) { document.write(''); document.write(' '); } function endTable() { document.write('
' + caption + '
'); } function renderIndices() { renderSecurities(indices, 'Global Indices', 'Data updated daily'); } function renderSecurities(dataArr, title, msg) { startTable(title, 4); document.write(''); document.write(' '); document.write(' Code'); document.write(' Last'); document.write(' Change'); document.write(' '); document.write(''); if (msg != '') { document.write(''); document.write(' '); document.write(' ' + msg + ''); document.write(' '); document.write(''); } document.write(''); for (var i=0; i < dataArr.length; i++) { var s = dataArr[i]; if (s.movement > 0) img = '↑'; else if (s.movement < 0) img = '↓'; else img = '↔'; if ((i % 2) == 0) clStr = 'wlOdd'; else clStr = 'wlEven'; if (s.movement > 0) mclStr = 'wlMovementUp'; else if (s.movement < 0) mclStr = 'wlMovementDown'; else mclStr = 'wlMovementEven'; document.write(''); document.write(' ' + s.name + ''); document.write(' ' + s.value + ''); document.write(' ' + img + ''); document.write(' ' + s.percentMovement + '%'); document.write(''); } document.write(''); endTable(); }