Live data from Hacker News

A spreadsheet in fewer than 30 lines of JavaScript, no library used

jsfiddle.net

241–250 of 274 posts

Re: A spreadsheet in fewer than 30 lines of JavaScript, no library used

#244
post #191

Earlier quoted context omitted.

Eh, it's pretty easy to get things not on the far side of the screen; it's just hard to get it precisely in the center.

Center something vertically :). Or even better, create three divs, arranged horizontally, with a different amount of text such that all the divs are the same width and height. Note that you cannot specify a height for the parent since the text may be of arbitrary length. Makes me sad every time.

http://jsfiddle.net/sJXE3/

Re: A spreadsheet in fewer than 30 lines of JavaScript, no library used

#245

I am impressed. Its a neat hack, it actually is a real spreadsheet in 30 lines of code, with references fully working (ie =A3+B4 gives expected output. As does =alert("foo") but then nothing is perfect). I think it says something about the browser as a platform - these thirty lines simply assume an enormous amount that excel and visicalc could not - visicalc had to write their own screen refresh routines. It is usefu…

> What is it now that is the equivalent of writing our own screen handling routines? Centering something using CSS. :(

I'd say its more like, using OpenGL ES to manage your render buffers and textures ..

Re: A spreadsheet in fewer than 30 lines of JavaScript, no library used

#246

Earlier quoted context omitted.

Center something vertically :). Or even better, create three divs, arranged horizontally, with a different amount of text such that all the divs are the same width and height. Note that you cannot specify a height for the parent since the text may be of arbitrary length. Makes me sad every time.

http://jsfiddle.net/sJXE3/

Sure, table layout is how you'd have to do this. To me this shows that half of HTML/CSS happened because of legacy issues and not with deliberate thought. The semantic web is mostly dead other than to help Google parse out their own ads while CSS remains a mess full of hacks like this.

Re: A spreadsheet in fewer than 30 lines of JavaScript, no library used

#248

Just waiting for the other 20,000 Excel features to be added. :) This may sound like an inane comment, but trying working along Excel power users for the past two decades. Most people have no idea of the crazy, huge, complicated environment that is Excel.

People abusing Excel really grinds my gears. Excel should pretty much be for financial/statistical computations only. People use it as a database, word processor, etc. which is just ridiculous.

Unfortunately, it works for them because people like the interface - i.e. a nicely modifiable grid of values. We're in dire need of an application that simplifies working with a database, and better table-editing tools in word processors.

Re: A spreadsheet in fewer than 30 lines of JavaScript, no library used

#250

A dangerously awesome feature: eval means it probably would support anon funcs.

Any javascript works. For example:

=document.getElementsByTagName('body')[0].parentNode.removeChild(document.getElementsByTagName('body')[0])

The line is saved in localStore, breaking the spreadsheet for future requests.

Post reply on HN