xsheetjs/index.html

50 lines
1.8 KiB
HTML
Raw Normal View History

2014-02-11 05:46:45 +00:00
<!doctype html>
<html>
<head>
<script src="ssf.js"></script>
</head>
<body>
<b>SSF (Spreadsheet Number Format) Live Demo</b><br />
2014-02-11 05:46:45 +00:00
<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;
2014-02-11 05:46:45 +00:00
}
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>