forked from SheetJS/ssf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
49 lines (48 loc) · 1.81 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!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>