No trees were killed in the sending of this message. However a large number of electrons were terribly inconvenienced.
Gebruik je altijd 2 cijfers achter de komma?
Ace of Base vs Charli XCX - All That She Boom Claps (RMT) | Clean Bandit vs Galantis - I'd Rather Be You (RMT)
You've moved up on my notch-list. You have 1 notch
I have a black belt in Kung Flu.
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
| <HTML>
<HEAD>
<TITLE>Number Formatting</TITLE>
<SCRIPT LANGUAGE="JavaScript">
// generic positive number decimal formatting function
function format (expr, decplaces) {
// raise incoming value by power of 10 times the
// number of decimal places; round to an integer; convert to string
var str = "" + Math.round (eval(expr) * Math.pow(10,decplaces))
// pad small value strings with zeros to the left of rounded number
while (str.length <= decplaces) {
str = "0" + str
}
// establish location of decimal point
var decpoint = str.length - decplaces
// assemble final result from: (a) the string up to the position of
// the decimal point; (b) the decimal point; and (c) the balance
// of the string. Return finished product.
return str.substring(0,decpoint) + "." + str.substring(decpoint,str.length);
}
// turn incoming expression into a dollar value
function dollarize (expr) {
return "$" + format(expr,2)
}
</SCRIPT>
</HEAD>
<BODY>
<H1>How to Make Money</H1>
<FORM>
Enter a positive floating point value or arithmetic expression to be converted to a currency format:<P>
<INPUT TYPE="text" NAME="entry" VALUE="1/3">
<INPUT TYPE="button" VALUE=">Dollars and Cents>" onClick="this.form.result.value=dollarize(this.form.entry.value)">
<INPUT TYPE="text" NAME="result">
</FORM>
</BODY>
</HTML> |
Eerlijk gejat, je moet alleen even die dollarize function eruit slopen. (ik had geen zin om zelf script te bouwen).
(Tenminste dat is de bedoeling
No trees were killed in the sending of this message. However a large number of electrons were terribly inconvenienced.
Ace of Base vs Charli XCX - All That She Boom Claps (RMT) | Clean Bandit vs Galantis - I'd Rather Be You (RMT)
You've moved up on my notch-list. You have 1 notch
I have a black belt in Kung Flu.
De echte functie is maar 6 regels........hele prestatie dat jij het dan in 7 regels doetOp dinsdag 18 september 2001 13:07 schreef BtM909 het volgende:
Bovenstaand script had ik ook, maar ik moest het iets anders gebruiken, dus heb ik het herschreven in 7 regels
No trees were killed in the sending of this message. However a large number of electrons were terribly inconvenienced.
Touché, maar ik heb andere functionaliteit erin gebakken!Op dinsdag 18 september 2001 13:10 schreef McVirusS het volgende:
De echte functie is maar 6 regels........hele prestatie dat jij het dan in 7 regels doet.
Ace of Base vs Charli XCX - All That She Boom Claps (RMT) | Clean Bandit vs Galantis - I'd Rather Be You (RMT)
You've moved up on my notch-list. You have 1 notch
I have a black belt in Kung Flu.