Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

how to get tabular output.?

Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everyone,i am new to the javascript .i have started writing one function and i need your help in that.

I have to write the function .

function logtable(actionname,starttime)
1) i am getting two parameters actionname, i have to make a table where parameters represents the 3 columns.i have to append the data in the table .
2)the o/p will be like this(tabular format):

actionname starttime delta

start 0
open 50
save 20

delta is the difference between the two consecutive starttime.
i have to append each incomming record in the next row(as i have shown in the o/p) .how should i do this(how to create table and append record to that and how to subtarct two strings(starttime) to get delta??

thank you.
swapnil paranjape
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everybody....i cud manage to write values in the table but i donot know how to calculate difference between two consecutive starttime values
delta = startime2 -starttime1 i.e. difference between two consecutive starttimes....hence delta in first row will be zero and then it will have value.

function PrtRow(action, starttime) {

var delta = starttime;
newcol = "/TD TD ALIGN='RIGHT'>";
document.write("TR TD ", action, newcol, starttime, newcol,
delta, "</TD></TR>\n")

var temp1 = starttime;
PrtRow("start", 11);
PrtRow("open", 12);
PrtRow("save", 13);
PrtRow("upload", 14);
PrtRow("new", 15);
PrtRow("upload", 16);
    Bookmark Topic Watch Topic
  • New Topic