...

View Full Version : js, post new delete old



humanescape
07-20-2007, 03:35 PM
how do i get javascript to add to say, 20 lines, and if theres say 3 lines being added, remove the last 3 lines and add the new 3?

so:

blah blah
blah 2
blah 3
blah 4

new line
blah blah
blah 2
blah 3
blah 4


blah 4 must be removed.

thanks

rnd me
07-20-2007, 04:46 PM
something like:


//lines>array|remove 1st 3|add 3 more. . . |
text.split("\n").slice(2).concat([blah5, blah6, blah7])

humanescape
07-26-2007, 04:17 AM
something like:


//lines>array|remove 1st 3|add 3 more. . . |
text.split("\n").slice(2).concat([blah5, blah6, blah7])


. . . that could very well work..huh...so simple? wow..thanks ill try it out!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum