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','10846.981','125.271','1.17','0',''); indices[1] = new security('FTSE','US.FTSE','5650.830','28.270','0.50','0',''); indices[2] = new security('DJIA','US.^DJI','10733.670','47.690','0.45','194188800',''); indices[3] = new security('NASDAQ','US.^COMP','2389.090','11.080','0.47','0',''); indices[4] = new security('H.SENG','US.^HSI','21384.490','361.560','1.72','0',''); indices[5] = new security('S&P500','US.^SPX','1166.210','6.750','0.58','0',''); indices[6] = new security('ALLORDS','ASX.XAO','4877.700','10.800','0.22','1667233170',''); ///// 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(); }