javascript - Loading an Array from Java Script into Web page -
i have included fiddle here: jsfiddle.net/lge3n
i have series of arrays in javascript file need import web page. seem able work arrays in script , have been able output totals of numbers page, however, not seem able figure out how print entire list web page.
window.onload = function () { $("#contributions").html (totalcontributions.tofixed(2)); $("#amount").html (totalcontributors); var datestring = ""; (var j = 0; j < date.length; j++) { datestring += date[j]; $("#datearray").html (datestring); } }
.
<div id="data_list"> <table rules="rows" cellspacing='0'> <thead> <tr> <th>date</th> <th>amount</th> <th>first name</th> <th>last name</th> <th>address</th> </tr> <td> <p>datearray</p> <id "datearray"> </td> <td> <p>amountarray</p> </td> <td>
this isn't hard, need loop returns each row , append table.
var count = firstname.length, sum = 0; (var = 0; < count; i++) { sum += parsefloat(amount[i]); html = '<tr><td>'+ date[i] +'</td><td>'+ amount[i] +'</td><td>'+ firstname[i] +'</td><td>'+ lastname[i] +'</td><td><p>'+ street[i] +'<br>'+ city[i] +' '+ state[i] +' '+ zip[i] +'</p></td></tr>'; $('#data').append(html); }; $('#contributions').html(count); $('#amount').html(sum);
Comments
Post a Comment