Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Other counting problem

0 views
Skip to first unread message

Joszja

unread,
Oct 24, 2000, 3:00:00 AM10/24/00
to
Furst of all..many thanx for the help I got for my first question.
Problem solved !! It took me days without result and the answer was simple
and it works fine now.

The other thing I have is that the result only must have 2 digits behind the
comma....How do I do this ?? Again I searched for some time and get no
solution.

Code >>

<script language="JavaScript">
<!--

<!-- Begin
function calc1(form) {
minimumloon = 31726.00;
leeftijd = parseFloat(form.leeftijd.value);
salaris = parseFloat(form.salaris.value);
middenstand = form.salaris.value - minimumloon;
uitkomst = ((leeftijd + 1) - 15) * 0.014 * middenstand + 21600.00;
vervolgberekening = (salaris * 0.7) - uitkomst;

form.total1.value = vervolgberekening;
}

// End -->
file://-->
</script>

<form name="form1">
<table width="100%" border="0" cellspacing="2" cellpadding="2"
align="center">
<tr align="center">
<td class="tableTextBold" width="28%">Uw Leeftijd</td>
<td class="tableTextBold" width="40%">Jaarsalaris </td>
<td class="tableTextBold" width="32%">
<input type="button" value="Bereken"
onClick="calc1(this.form)" name="button">
</td>
</tr>
<tr align="center">
<td class="tableTextBold" width="28%">
<input type="text" name="leeftijd" size=5>
</td>
<td class="tableTextBold" width="40%">
<input type="text" name="salaris" size=10>
</td>
<td class="tableTextBold" width="32%">
<input type="text" name="total1"
size=10>
</td>
</tr>
<tr align="center">
<td class="tableTextBold" width="28%">&nbsp;</td>
<td nowrap width="40%" align="left"><font size="1"><b><font
face="Arial, Helvetica, sans-serif">*
Bruto inclusief vakantiegeld<br>
* Zonder punten of comma's</font></b></font></td>
<td class="tableTextBold" width="32%">&nbsp;</td>
</tr>
</table>
</form>


Many thanx in advanced !
Joszja


alti

unread,
Oct 24, 2000, 3:00:00 AM10/24/00
to

Hello,
I don't know if it is what you want?!
perjap's someone could do it better!

<!-- Begin
function calc1(form) {
minimumloon = 31726.00;
leeftijd = parseFloat(form.leeftijd.value);
salaris = parseFloat(form.salaris.value);
middenstand = form.salaris.value - minimumloon;
uitkomst = ((leeftijd + 1) - 15) * 0.014 * middenstand + 21600.00;
vervolgberekening = (salaris * 0.7) - uitkomst;

word=new String(vervolgberekening);
cut=word.split('.');
if (cut[1]) {
part2=cut[1].substring(0,2);
vervolgberekening=cut[0]+"."+part2;
} else {
vervolgberekening=cut[0];
};

form.total1.value = vervolgberekening;
}


alti

--
Alti the MrA

Dave Bird

unread,
Oct 24, 2000, 3:00:00 AM10/24/00
to
In article <8t3gs5$ksq$1...@news1.xs4all.nl>, Joszja <jos...@easyit.nl>
writes

>The other thing I have is that the result only must have 2 digits behind the
>comma....How do I do this ?? Again I searched for some time and get no
>solution.

public void show( float x ){ int y = x*100, y1 = y%100;

System.out.println( (y-y1) + "." + y1 );

};

Well, it works!

--
^-^-^-@@-^-;-^ http://www.xemu.demon.co.uk/
(..)__u news:alt.smoking.mooses

0 new messages