🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.javascript
Article #56

Again me and my counter problems - please help

#56
From: 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
Technical Details
Message-ID: <8tmmjn$i33$1@doppler.a2000.nl>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-03!sn-xit-uk!supernews.com!195.40.4.120.MISMATCH!easynet-quince!easynet.net!news1.carrier1.net!newsfeeds.belnet.be!news.belnet.be!news.tele.dk!62.108.1.23!pascal.a2000.nl!newsfeed.a2000.nl!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10bacc,cbcb4dffcc74d111,start
X-Google-Attributes: gid10bacc,public
X-Google-Thread: 10731d,cbcb4dffcc74d111,start
X-Google-Attributes: gid10731d,public
X-Google-Thread: fb3cb,cbcb4dffcc74d111,start
X-Google-Attributes: gidfb3cb,public
X-Google-Thread: 10d861,cbcb4dffcc74d111,start
X-Google-Attributes: gid10d861,public
X-Google-Thread: fa828,cbcb4dffcc74d111,start
X-Google-Attributes: gidfa828,public
X-Google-Thread: 113ae9,cbcb4dffcc74d111,start
X-Google-Attributes: gid113ae9,public
X-Google-ArrivalTime: 2000-10-31 06:56:56 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-03!sn-xit-uk!supernews.com!195.40.4.120.MISMATCH!easynet-quince!easynet.net!news1.carrier1.net!newsfeeds.belnet.be!news.belnet.be!news.tele.dk!62.108.1.23!pascal.a2000.nl!newsfeed.a2000.nl!not-for-mail
From: joszja@easyit.nl (JOSZJA)
Newsgroups: comp.lang.javascript,alt.www.hotjava,borland.public.intrabuilder.javascript,borland.public.jbuild,comp.lang.java.help,comp.lang.java.javascript
Subject: Again me and my counter problems - please help
Date: Tue, 31 Oct 2000 23:50:55 GMT
Organization: A2000 Kabeltelevisie en Telecommunicatie
Lines: 126
Message-ID: <8tmmjn$i33$1@doppler.a2000.nl>
NNTP-Posting-Host: node1bdc1.a2000.nl
X-Trace: doppler.a2000.nl 973004215 18531 24.132.189.193 (31 Oct 2000 14:56:55 GMT)
X-Complaints-To: abuse@a2000.nl
NNTP-Posting-Date: 31 Oct 2000 14:56:55 GMT
X-Newsreader: Forte Free Agent 1.0.82