/    Sign up×
Community /Pin to ProfileBookmark

What is the function codes for "IF"?

**Note sign “>” means greater than.

IF “GRT” > 40000, “Port dues” will show result 175,
IF “GRT” > 20000, “Port dues” will show result 140,
IF “GRT” > 10000, “Port dues” will show result 105,
IF “GRT” > 5000, “Port dues” will show result 80,
IF “GRT” > 2000, “Port dues” will show result 60,
IF “GRT” > 1000, “Port dues” will show result 40,
IF “GRT” > 75, “Port dues” will show result 25

Link: [url]http://www.oceanbulk.com.sg/maths.html[/url]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@PittimannJul 23.2004 — Hi!

function calcValue(){

dues=document.getElementById('j');

val=Number(getEl('a').value);

if(val>40000)dues.value=175

else if(val>20000)dues.value=140

else if(val>10000)dues.value=105

else if(val>5000)dues.value=80

else if(val>2000)dues.value=60

else if(val>1000)dues.value=40

else if(val>75)dues.value=25

document.getElementById('total').value = Number(getEl('a').value) + Number(getEl('b').value) + Number(getEl('c').value) + Number(getEl('d').value) + Number(getEl('e').value) + Number(getEl('f').value) + Number(getEl('g').value) + Number(getEl('g').value) + Number(getEl('i').value) + Number(getEl('j').value) + Number(getEl('k').value) + Number(getEl('l').value);

}

Cheers - Pit
Copy linkTweet thisAlerts:
@PittimannJul 23.2004 — Hi!

In reply to your pm:[code=php]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>AGENCY PROFORMA FOR VESSEL CALL SINGAPORE FOR BUNKERING AT ANCHORAGE::MARS Shipping & Trading</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style type="text/css">
fieldset { padding: 1em }
</style>
<script type="text/javascript">
function bindEvents(){
for(i=0; i<arguments.length; i++){
arguments[i].onkeydown = calcValue;
arguments[i].onkeyup = calcValue;
}
}
function getEl(id) { return document.getElementById(id) }
function calcValue(){
document.getElementById('j').value = Number(getEl('a').value) / 100;
dues=document.getElementById('k');
val=Number(getEl('a').value);
if(val>40000)dues.value=175
else if(val>20000)dues.value=140
else if(val>10000)dues.value=105
else if(val>5000)dues.value=80
else if(val>2000)dues.value=60
else if(val>1000)dues.value=40
else if(val>75)dues.value=25
else if(val<=75)dues.value=0//do not know, if you need this
document.getElementById('total').value = Number(getEl('a').value) + Number(getEl('b').value) + Number(getEl('c').value) + Number(getEl('d').value) + Number(getEl('e').value) + Number(getEl('f').value) + Number(getEl('g').value) + Number(getEl('g').value) + Number(getEl('i').value) + Number(getEl('j').value) + Number(getEl('k').value) + Number(getEl('l').value);
}
onload = function(){
bindEvents(getEl('a'), getEl('b'), getEl('c'), getEl('d'), getEl('e'), getEl('f'), getEl('g'), getEl('h'), getEl('i'), getEl('j'), getEl('k'), getEl('l'));
}
</script>
</head>
<body>
<form action="#">
<fieldset>
<legend>AGENCY PROFORMA FOR VESSEL CALL SINGAPORE FOR BUNKERING AT ANCHORAGE</legend>
<dl>
<dt><label for="a">GRT:</label></dt>
<dd><input type="text" id="a"></dd>
<dt><label for="b">Agency fee for first 48 hours</label></dt>
<dd><input type="text" id="b"></dd>
<dt><label for="c">Every subsequent day after 48 hours</label></dt>
<dd><input type="text" id="c"></dd>
<dt><label for="d">TLX/Fax/Ship call</label></dd>
<dd><input type="text" id="d"></label></dd>
<dt><label for="e">Agent transport fee</label></dt>
<dd><input type="text" id="e"></label></dd>
<dt><label for="f">Crew change (excluding transport/hotel/boat chanrge &#8212; if any)</label></dd>
<dd><input type="text" id="f"></dd>
<dt><label for="g">Agency service boat</label></dt>
<dd><input type="text" id="g"></dd>
<dt><label for="h">Cash to master expenses</label></dt>
<dd><input type="text" id="h"></dd>
<dt><label for="i">DOCUMENT & SPARE PARTS</label></dt>
<dd><input type="text" id="i"></dd>
<dt><label for="j">PORT DUES FOR FIRST 24 HRS</label></dt>
<dd><input type="text" id="j"></dd> <font color=red><b>This is the one...</b></font>
<dt><label for="k">NMB FEE</label></dt>
<dd><input type="text" id="k"></dd>
<dt><label for="l">PILOTAGE IN / OUT</label></dt>
<dd><input type="text" id="l"></dd>
</dl>
<hr>
<label for="total">Total:</label>
<input type="text" id="total" value="0">
<input type="reset">
<INPUT TYPE="button" VALUE=" Print Page " onclick="javascript:window.print()">
</fieldset>
</form>
</body>
</html>[/code]
Was it that, what you need??

Cheers - Pit
×

Success!

Help @oceanmaid spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...