2017-04-30 04:54:41 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<!-- ssf.js (C) 2013-present SheetJS http://sheetjs.com -->
|
|
|
|
<!-- vim: set ts=2: -->
|
2014-02-11 05:46:45 +00:00
|
|
|
<html>
|
2017-04-30 04:54:41 +00:00
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
|
|
<title>SSF Live Demo</title>
|
|
|
|
<style>
|
|
|
|
a { text-decoration: none }
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<pre>
|
|
|
|
<b><a href="http://sheetjs.com">SSF (Spreadsheet Number Format) Live Demo</a></b>
|
2014-02-11 05:46:45 +00:00
|
|
|
|
2017-04-30 04:54:41 +00:00
|
|
|
<a href="https://github.com/SheetJS/ssf">Source Code Repo</a>
|
|
|
|
<a href="https://github.com/SheetJS/ssf/issues">Issues? Something look weird? Click here and report an issue</a>
|
|
|
|
</pre>
|
|
|
|
<table>
|
|
|
|
<tr><td><b>Format code:</b></td><td><input type="text" id="fmt" value="General"></td></tr>
|
|
|
|
<tr><td><b>Value:</b></td><td><input type="text" id="val" value="3.1415926535"></td></tr>
|
|
|
|
<tr><td colspan="2"> </td></tr>
|
|
|
|
<tr><td><b>Formatted Number:</b></td><td><pre id="num"></pre></td></tr>
|
|
|
|
<tr><td><b>Formatted Text</b></td><td><pre id="txt"></pre></td></tr>
|
|
|
|
</table>
|
|
|
|
<script src="ssf.js"></script>
|
|
|
|
<script>
|
|
|
|
/*jshint browser:true */
|
2017-08-01 02:28:37 +00:00
|
|
|
/*eslint-env browser */
|
2018-02-21 03:35:31 +00:00
|
|
|
/*eslint no-use-before-define:0 */
|
2017-07-28 20:24:37 +00:00
|
|
|
/*global SSF */
|
2017-04-30 04:54:41 +00:00
|
|
|
var F = document.getElementById('fmt');
|
2017-07-28 20:24:37 +00:00
|
|
|
var V = document.getElementById('val');
|
2017-04-30 04:54:41 +00:00
|
|
|
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; }
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Bind to relevant events */
|
|
|
|
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();
|
|
|
|
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>
|
|
|
|
</body>
|
2014-02-11 05:46:45 +00:00
|
|
|
</html>
|