🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.javascript
1 messages
1 total messages Started by JOSZJA Tue, 31 Oct 2000 23:50
Again me and my counter problems - please help
#56
Author: JOSZJA
Date: Tue, 31 Oct 2000 23:50
124 lines
5681 bytes
Furst thanx for all the help I got before.

It was allready complicated for me but now I need to do a ' If ' and '
Then
' so I really can use some help and lurn a lot from the explenations.

The furst problem is as follows :

If the input from ' salaris ' is higher than 84715 it has to take 70%
of the
difference and count it on the result.
Exsample : salaris= 120000  - the calculation would be
  70% X (120000 - 84715) = 24699.50
The outcome must be counted on the final result

The second problem is as follows :
If the input ' leeftijd ' is lower 22 or higher than 65 it has to
generate a
txt with a explanation.

So two differend If and then statements.
I know I asked a lot allready about this calculator but again I'm
stuck.
Please help.

The code ----------------------------------------------------------->

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

<!-- Begin
function calc1(form) {
detekst = "Het wao-gat bedraagd:";
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;
 form.waotxt.value = detekst;
 }
//  End -->
file://-->
</script>

The form ------------------------------------------------>

<form name="form1">
              <table width="100%" border="0" cellspacing="2"
cellpadding="2"
align="center">
                <tr valign="middle">
                  <td class="tableTextBold" width="30%"
align="left">&nbsp;</td>
                  <td class="tableTextBold" width="27%"
align="left">&nbsp;</td>
                  <td class="tableTextBold" width="43%"
align="left">&nbsp;</td>
                </tr>
                <tr valign="middle">
                  <td class="tableTextBold" width="30%"
align="left">Uw
Leeftijd</td>
                  <td class="tableTextBold" width="27%" align="right"
valign="middle">
                    <input type="text" name="leeftijd" size=5>
                  </td>
                  <td align="left" width="43%"
class="tableTextBold">jaar
</td>
                </tr>
                <tr valign="middle">
                  <td class="tableTextBold" width="30%">Jaarsalaris
</td>
                  <td width="27%" align="right" nowrap> <font
face="Arial,
Helvetica, sans-serif"><b><font size="2">Fl.</font></b></font>
                    <input type="text" name="salaris" size=8>
                  </td>
                  <td class="tableTextBold" width="43%" nowrap><font
size="1"><b><font face="Arial, Helvetica, sans-serif">*
                    Bruto inclusief vakantiegeld<br>
                    * Zonder punten of comma's</font></b></font></td>
                </tr>
                <tr valign="middle">
                  <td class="tableTextBold" width="30%" align="left"
valign="middle">
                    <input type="button" value="Bereken"
onClick="calc1(this.form)" name="button">
                  </td>
                  <td nowrap width="27%">
                    <input type="text" name="waotxt"
onChange="this.value='Locked text!';" size=22 readonly
class="wao_output">
                  </td>
                  <td align="left" width="43%" valign="middle" nowrap>
<font
face="Arial, Helvetica, sans-serif"><b><font
size="2">Fl.</font></b></font>
                    <input type=text name=total1
onChange="this.value='Locked text!';" size=8 readonly
class="noborder_form">
                  </td>
                </tr>
                <tr valign="middle">
                  <td class="tableTextBold" width="30%">&nbsp;</td>
                  <td nowrap width="27%">
                   </td>
                  <td class="tableTextBold" width="43%">&nbsp;</td>
                </tr>
              </table>
            </form>
Thank you and regards
joszja
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads