|
0
|
1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|
|
2 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
|
|
3 |
<head> |
|
|
4 |
<title>Number-Formatting Test</title> |
|
|
5 |
<script type="text/javascript" src="number-functions.js"></script> |
|
|
6 |
</head> |
|
|
7 |
<body> |
|
|
8 |
|
|
|
9 |
<script type="text/javascript"> |
|
|
10 |
function doit(form) { |
|
|
11 |
form.elements["dest"].value = new Number(form.elements["src"].value).numberFormat(form.elements["format"].value); |
|
|
12 |
form.elements["text"].value = Number.prototype[Number.formatFunctions[form.elements["format"].value]]; |
|
|
13 |
} |
|
|
14 |
</script> |
|
|
15 |
|
|
|
16 |
<h1>Number-Formatting Demo</h1> |
|
|
17 |
|
|
|
18 |
<p>Use the form below to experiment with the number-formatting functionality. |
|
|
19 |
You can enter a value and a format string, and then click the button to see the |
|
|
20 |
results. The code that's generated to handle the formatting will be |
|
|
21 |
displayed in the text area.</p> |
|
|
22 |
|
|
|
23 |
<form method="get" action=""> |
|
|
24 |
<table> |
|
|
25 |
<tr><td><label for="src">value</label></td><td><input id="src" type="text" name="src" /></td></tr> |
|
|
26 |
<tr><td><label for="format">format</label></td><td><input id="format" type="text" name="format" /></td></tr> |
|
|
27 |
<tr><td><label for="dest">result</label></td><td><input id="dest" type="text" name="dest" /></td></tr> |
|
|
28 |
<tr><td><input type="button" onClick="doit(this.form)" value="do it!" /></td><td></td></tr> |
|
|
29 |
</table> |
|
|
30 |
<textarea name="text" rows="10" style="width:100%"></textarea> |
|
|
31 |
</form> |
|
|
32 |
|
|
|
33 |
</body> |
|
|
34 |
</html> |