sheetjs/index.html
SheetJS 2dd9c7ec99 version bump 0.6.5: eliminating bad idioms
- cleaned up implicit boolean to number conversions
- web demo improved (h/t /u/SpsD3GoiFSmXBAl on reddit)
2014-04-25 11:22:36 -07:00

50 lines
1.8 KiB
HTML

<!doctype html>
<html>
<head>
<script src="ssf.js"></script>
</head>
<body>
<b>SSF (Spreadsheet Number Format) Live Demo</b><br />
<a href="https://github.com/SheetJS/ssf">Github Repo</a><br />
<a href="https://github.com/SheetJS/ssf/issues">Issues? Something look weird? Click here and report an issue</a><br />
<div>
<p><b>Format code:</b> <input type="text" id="fmt" value="General"></p>
<p><b>Value: </b> <input type="text" id="val" value="3.1415926535"></p>
<p><b>Formatted Number:</b> <pre id="num"></pre></p>
<p><b>Formatted Text</b> <pre id="txt"></pre></p>
</div>
</body>
<script>
var F = document.getElementById('fmt');
var V = document.getElementById('val');
var N = document.getElementById('num');
var T = document.getElementById('txt');
function update() {
try { N.innerHTML = SSF.format(F.value, Number(V.value)); } catch(e) { N.innerHTML = e; }
try { T.innerHTML = SSF.format(F.value, V.value); } catch(e) { T.innerHTML = e; }
}
if(F.addEventListener) {
F.addEventListener('keyup', update);
V.addEventListener('keyup', update);
} else if(F.attachEvent) {
F.attachEvent('onkeyup', update);
V.attachEvent('onkeyup', update);
} else {
F.oninput = update;
V.oninput = update;
}
update();
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-36810333-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</html>